天天看點

Java背景跳出前台Jsp頁面的父頁面(frameset架構)

許多背景頁面都會用到架構結構,在前台點選登出後,通常隻是頁面的主部分退出,造成了頁面的重疊,若要實作整個頁面的跳轉,可用js完成:

<a href="javascript:void(0);" target="_blank" rel="external nofollow"  id="exit">系統退出</a>
           
$("#exit").click(function(){
				if (confirm("您确定要退出系統嗎?")){
					parent.window.location = "login.html";
				}
			});
           

而在背景,需要用過濾器檢測使用者的狀态,session過期或者強制進入背景的話,将回到登入界面

背景過濾器代碼:

HttpServletResponse httpServletResponse = (HttpServletResponse) response;
httpServletResponse.getWriter().print("<script>parent.window.location.href='nav?id=1'</script>");