为了账号安全,请及时绑定邮箱和手机立即绑定

请教JAVA拦截器问题,过滤带有aa前缀的 设置<url-pattern>/aa*</url-pattern> 但是aabb不拦截

请教JAVA拦截器问题,过滤带有aa前缀的 设置<url-pattern>/aa*</url-pattern> 但是aabb不拦截

石头Sky 2016-10-08 11:37:05
如题web.xml<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">   <display-name>G</display-name>   <welcome-file-list>     <welcome-file>index.html</welcome-file>     <welcome-file>index.htm</welcome-file>     <welcome-file>index.jsp</welcome-file>     <welcome-file>default.html</welcome-file>     <welcome-file>default.htm</welcome-file>     <welcome-file>default.jsp</welcome-file>        </welcome-file-list>     <filter>         <filter-name>cccc</filter-name>         <filter-class>cc</filter-class>         <async-supported>true</async-supported>     </filter>     <filter-mapping>         <filter-name>cccc</filter-name>         <url-pattern>/aa*</url-pattern>     </filter-mapping> </web-app>cc.javaimport java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; public class cc implements Filter { @Override public void destroy() { System.out.println("销毁"); } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { System.out.println("1"); //chain.doFilter(request, response); request.getRequestDispatcher("index.jsp").forward(request, response); System.out.println("2"); } @Override public void init(FilterConfig filterConfig) throws ServletException { System.out.println("初始化"); } }
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 2357 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信