用于过滤没用进行用户登入的访问 MyFilter MyFilter org.jxnd.Fliter.MyFilter MyFilter /* //里面的内容是用于写需要过滤的路径 public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain
MyFilter MyFilter org.jxnd.Fliter.MyFilter public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { // TODO Auto-generated method stub // place your code here HttpSession session=((HttpServletRequest)request).getSession(); request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); String name=request.getParameter("name"); session.setAttribute("name", name); if(((HttpServletRequest)request).getServletPath().equals("/NewFile.jsp")){ chain.doFilter(request, response); }else if(session.getAttribute("name")!=null&&session.getAttribute("name")!=""){ chain.doFilter(request, response); }else{ } } MyFilter /* //里面的内容是用于写需要过滤的路径