例如:我有一些jsp页面。但我只想让我的过滤器中的一些工作。 我怎么配置成功呢? 谢谢!我整天困扰着我!
答案 0 :(得分:0)
您必须将JSP页面放在不同的目录中,而不是放在web.xml中:
<filter>
<filter-name>FilterName1</filter-name>
<filter-class>com.example.Filter1</filter-class>
</filter>
<filter-mapping>
<filter-name>FilterName1</filter-name>
<url-pattern>/directory-for-filter-1/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>FilterName2</filter-name>
<filter-class>com.example.Filter2</filter-class>
</filter>
<filter-mapping>
<filter-name>FilterName2</filter-name>
<url-pattern>/directory-for-filter-2/*</url-pattern>
</filter-mapping>