當用戶長時間停留在管理界面沒有操作,等到session過期後,進行了操作,那麼只是iframe跳轉到login頁面,這不是我們想要的結果。
方法一:
在login頁面加一個邏輯判斷:
<script >
$(document).ready(function () {
if (window != top) {
top.location.href = location.href;
}
});
</script>
方法二:
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;