How to specify more than one named Servlet to be wrapped by a filter?
How to specify more than one named Se开发者_StackOverflow中文版rvlet to be wrapped by a filter?
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
- The Essentials of Filters
精彩评论