日期:2014-05-17 浏览次数:20890 次
public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; if(getCookieByName(request, "AdminLogin_cookie")!=null){ request.getRequestDispatcher("/admiLogin/L.jsp").forward(request,response); }else { request.getRequestDispatcher("").forward(request,response); } }
<filter> <filter-name>FilterAction</filter-name> <filter-class> FilterAction.FilterAction </filter-class> </filter> <filter-mapping> <filter-name>FilterAction</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>