A filter is a piece of re-usable code that modifies requests to and responses from a servlet. Filters can perform many functions, including (but not limited to):
The IDE provides a wizard to help you create both simple and more advanced filter elements.
![]() |
Filters are run on each mapped request, therefore you cannot run or debug them individually. |
Filters are declared using the filter element in the web application's deployment descriptor (web.xml) and are packaged in a WAR file along with the static content and servlets that make up a web application. A filter or collection of filters can be configured for invocation by defining the filter mapping elements in the deployment descriptor.
For more information about filters, see the Java Servlet Technology Documentation available at