日期:2014-05-20 浏览次数:20714 次
<filter> <filter-name>SessionValidFilter</filter-name> <filter-class>web.filter.SessionValidFilter</filter-class> </filter> <filter-mapping> <filter-name>SessionValidFilter</filter-name> <url-pattern>/jsp/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>SessionValidFilter</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping> <filter-mapping> <filter-name>SessionValidFilter</filter-name> <url-pattern>/servlet/*</url-pattern> </filter-mapping>
------解决方案--------------------
写个类,继承Filter。
然后在web.xml里面添加拦截
<filter> <filter-name>filter名</filter-name> <filter-class>你的filter类路径</filter-class> </filter> <filter-mapping> <filter-name>filter名</filter-name> <url-pattern>你要拦截的路径,如:/*</url-pattern> </filter-mapping>