请问一个过滤器的问题。刚学JAVA,请各位多帮忙!谢谢!
请问我想在过滤器中不过滤一种文件应该怎么写web.xml文件?
例如:
有*.jsp,*.html,*.gif文件,我只想过滤 *.jsp和*.html,不想过滤 *.gif。请问怎么写?
我想这么写,可是提示有错:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<filter>
<filter-name>logfilter</filter-name>
<filter-class>com.LogFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>logfilter</filter-name>
<url-pattern>/*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>logfilter</filter-name>
<url-pattern>/*.html</url-pattern>
</filter-mapping>
</web-app>