请教JAVA拦截器问题,过滤带有aa前缀的 设置<url-pattern>/aa*</url-
如题
web.xml
G index.html index.htm index.jsp default.html default.htm default.jsp cccc cc true cccc /aa* cc.java
import 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("初始化"); }} |
免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。
版权声明:作者保留权利,不代表天盟立场。
|
|
|
|