session 过期返回登录页面
方法1,
HttpSession session = request.getSession(); String LOGIN_ID = (String) session.getAttribute("LOGIN_ID"); if (null == LOGIN_ID||"".equals(LOGIN_ID)) { java.io.PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<script>"); out.println("window.open ('"+request.getContextPath()+"/login.jsp','_top')"); out.println("</script>"); out.println("</html>"); return;
方法2.
在login.jsp中加入
<script> if(window.top!==window.self){window.top.location=window.location}; </script>