这是登陆页面:
然后登陆进来之后是这个页面:这个页面里的每一个页签都是ajax请求(局部刷新页签下面的区域),我有个过滤器检查,当页面session过期之后,会返回到登陆页面。但是结果是这样的(ajax请求返回的登陆页面的html):有什么解决方法没?

解决方案 »

  1.   

    网上说在login.jsp里加上这段js,但是好像没用// session expired
    if (window != top){
    top.location.href = location.href;
    }
      

  2.   

    这是我的过滤器代码:   public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
            // TODO Auto-generated method stub        HttpServletRequest request = (HttpServletRequest) req;
            HttpServletResponse response = (HttpServletResponse) res;
            HttpSession session = request.getSession();
            UserDTO user = (UserDTO)session.getAttribute("user");
            if (user == null) {
              response.sendRedirect("login.jsp");
            } else {
              chain.doFilter(request, response);
            }
        }
      

  3.   

    top.window.location.href = location.href;
    试试
      

  4.   

    试了下好像不可以啊。加上这个,login.jsp加载进来一直重新加载,死循环了。
      

  5.   

    你可以拿到login.jsp后直接判断这个data是login.jsp,然后在用楼上的js处理下。top.window.location.href = location.href;