session过期返回登录页面跳出frame


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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM