session超時(shí)的時(shí)候需要跳轉(zhuǎn)登錄界面。如果在iframe中重定向會(huì)使頁(yè)面顯示在iframe中。
使用攔截器檢測(cè)session是否過(guò)期進(jìn)行頁(yè)面重定向一般使用response.sendRedirect("跳轉(zhuǎn)鏈接");但是在iframe中卻不能滿足要求.
下面是解決方法
//初始化一個(gè)輸入流向頁(yè)面發(fā)送一個(gè)javascript腳本
PrintWriter out = response.getWriter();
//system.out.println是在控制臺(tái)打印文本,而out.println()則是組成一段帶有格式的文本
out.println("<html>");
out.println("<script>");
out.println("window.open ('"+request.getContextPath()+"/index.jsp','_top')");
out.println("</script>");
out.println("</html>");
//該段腳本可以起到頁(yè)面執(zhí)行父頁(yè)面跳轉(zhuǎn)頁(yè)面的作用