主要是在做session失效的跳转时,由于页面由好几个frame构成,默认情况下,跳转回login页面的时候,是在某一个frame中显示的,这样明显有问题
解决办法:
1、在登录页面login.jsp中,加一段脚本
<script type="text/javascript"> if(self.location!=top.location){ top.location.href=self.location.href; } </script>
2)
新建一个中间页面,如下:relogin.jsp
<html>
<head>
<title></title>
<script type="text/javascript">
window.top.location='<%=request.getContextPath()%>';
</script>
</head>
</html>然后,在struts.xml里面配置一个全局结果:
<global-results>
<result name="relogin" >/relogin.jsp</result>
</global-results>最后,在拦截器中跳转到这个全局结果
本文介绍了解决Session失效后页面跳转至登录页时出现的问题,即如何避免在多个frame结构下只在一个frame中显示登录页的情况。通过两种方法实现:一是在登录页面加入JavaScript脚本确保跳转至顶层窗口;二是创建中间页面并配置Struts全局结果来统一处理跳转。
8521

被折叠的 条评论
为什么被折叠?



