views:

14

answers:

1

How to specify more than one named Servlet to be wrapped by a filter?

+2  A: 

You can map a filter to one or more servlets (and you can map more than one filter to a servlet).

...
<filter>
  <filter-name>filter_name</filter-name>
  <filter-class>filter_class</filter-class>
</filter>
...
<filter-mapping>
  <filter-name>filter_name</filter-name>
  <servlet-name>servlet_name_1</servlet-name>
</filter-mapping>
<filter-mapping>
  <filter-name>filter_name</filter-name>
  <servlet-name>servlet_name_2</servlet-name>
</filter-mapping>
...

See also

Pascal Thivent