跳转不到失败的页面啊,通过过滤器跳转不到啊,老师您好
你把源代码发出来看看
因为输入错误的时候 session为空即username==null,所以直接执行response.sendRedirect("login.jsp");
在web.xml中的配置没问题吗?
public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { HttpServletRequest request= (HttpServletRequest) arg0; HttpServletResponse response= (HttpServletResponse) arg1; System.out.println("过滤器启动"); if(request.getSession().getAttribute("usename")!=null){ System.out.println("111111"); arg2.doFilter(arg0, arg1); }else{ response.sendRedirect("login.jsp"); } System.out.println("关闭了!!!"); }