![]() |
![]() |
||||
This tag specifies a filter name, and either a URL mapping or servlet name, for a filter that has been defined with the <filter> tag.
Multiple <filter-mapping> tags can be specified for a single <filter>, providing different URL patterns. See the <url-pattern> tag for examples.
The <filter-mapping> has two required elements:
If a servlet name is specified, the filter will be called whenever the specific servlet is called.
<filter-mapping> <filter-name>MyFilter</filter-name> <url-pattern>/somePath/*</url-pattern> </filter-mapping> <filter> <filter-name>MyFilter</filter-name> <filter-class>com.mycompany.MyFilter</filter-class> </filter>