目的:跳过后面所有的过滤器,进入servlet中。
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
String servletPath = request.getServletPath();
System.out.println("进入过滤");
request.getRequestDispatcher(servletPath).forward(request, response);
}
perfer:http://blog.csdn.net/fulai0_0/article/details/51569804
——
——
——
=
=
=
本文介绍了一种通过在过滤器中使用dispatcher方法来直接访问目标Servlet的方式,以此达到跳过中间所有过滤器的目的。
3518

被折叠的 条评论
为什么被折叠?



