这是action的中代码 public String out() throws IOException{
HttpServletRequest request=ServletActionContext.getRequest();
request.setCharacterEncoding("utf-8");
HttpServletResponse response= ServletActionContext.getResponse();
response.setCharacterEncoding("gbk");
PrintWriter out=ServletActionContext.getResponse().getWriter();
ActionContext.getContext().getSession().remove("user_login");
ActionContext.getContext().getSession().clear();
out.write("<script language='javascript'>parent.window.document.location.location='/HaiMen/login.jsp';</script> ");
return null;
}这是过滤器的代码out.print("<script>alert('请先登陆');parent.window.document.location='/HaiMen/login.jsp';</script>");

解决方案 »

  1.   

    out.print("<script>alert('请先登陆');top.location='/HaiMen/login.jsp';</script>");
      

  2.   

    其实要防止刷新后 是要改action中的代码的。我在action 用的reload() 虽然可以防止f5后回到后台页面,但是每次点击退出后 会弹出请先登录,感觉很不友好
      

  3.   

    点击退出执行上一页的代码是正常的啊。
    你可以使用location.replace("newurl")防止点击后退,注意这个代码写的位置。写到前面的页面才有效