iframe里在top窗口跳转到登录页

一、java实现

权限filter里加入

PrintWriter out = response.getWriter();
out.write("<script>top.location.href='"+request.getContextPath() + "/login"+"'</script>");

 此种方法有一个优点,不用向服务器请求两次login页面

二、js实现

在login页面加入

<script type="text/javascript">
	if (window != top)
	top.location.href = location.href;
</script>

 此种方法有一个缺点,得请求两次login页面

猜你喜欢

转载自happyqing.iteye.com/blog/2321749