在main.jsp头部包含
<logic:notPresent name="<%=com.astro.util.AppConstants.ADMIN%>" scope="session">
<logic:forward name="failure"/>
</logic:notPresent>

解决方案 »

  1.   

    to: iiilin(iiilin) 
    我暂时也在用这样的方法,不过我做了一个check jsp,然后各个页面include一下<%@ include file="redirect(needReLogin).jsp" %>
    redirect(needReLogin).jsp:
    <%
    Object checkedForm = request.getSession().getAttribute("checkedForm");
    if(checkedForm == null)
    {
    RequestDispatcher rd = request.getRequestDispatcher("error(needReLogin).jsp"); 
    rd.forward(request,response);
    }
    %>
    这和你给出的使用struts的logic的思路差不多但是并不能根本解决问题,比如当session过期的时候,我在下面的frame(不妨假设只有header和body两个frame)发出了一个跳转的req,这时候由于session过期,filter就会把下面的frame redirect 到login,而此时header仍然存在着...我一直在想,能不能在filter类中做些手脚,比如判断request来至于sub frame,然后redirect parent?呵呵,想不通,就上来找大家讨论一下,希望各位继续帮忙~
      

  2.   

    真的没有更好的方法了么?难道大家都不用过filter做登录校验和session检查?
      

  3.   

    在登录页面动手脚,判断自己是在一个frame里面,就自动把顶层窗口的url改写为登录页面,用js来实现,类似下面的两行代码:
    if(self.location.href!=top.location.href)
        top.location.href=self.location.href;
      

  4.   

    解决问题了!原来自己一直没想通这个关键:去判断自身是否是frame!而是一味的从filter的url想办法,汗~多谢两位的帮忙了