日期:2014-05-19 浏览次数:20666 次
HttpServletResponse response =(HttpServletResponse) arg1; HttpServletRequest request = (HttpServletRequest)arg0; request.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); PrintWriter out=response.getWriter(); User user = (User)request.getSession().getAttribute("User"); request.getRequestURI(); System.out.println("uri:"+request.getRequestURI()); if (!request.getRequestURI().contains("login.jsp")) { if(null==user){ //response.sendRedirect(request.getContextPath()+"/login.jsp"); out.print("<script type='text/javascript'>alert('对不起您必须先登录系统!');window.open ('"+request.getContextPath()+"/index.jsp','newwindow','');</script>"); } } else{ arg2.doFilter(arg0, arg1); }
------解决方案--------------------
用户登录状态的校验可简可繁,看具体情况了
简单的可以把用户信息保存在Session、Cookie中
复杂的也有集成CA、U盾的
更高级的支持人脸识别,163邮箱现在就已经有人脸识别的功能了