日期:2014-05-17  浏览次数:20725 次

jsp退出登录后,按后退,又返回了登录的状态怎么办?
上网查了一些资料,说是IE缓存的关系,按照上面加了一些代码还是解决不了,请高手指教。



------解决方案--------------------
登录页面,禁止使用缓存

1.客户端缓存要在<head>中加入类似如下内容: 
HTML code

 <meta http-equiv="pragma" content="no-cache"> 
     <meta http-equiv="cache-control" content="no-cache"> 
     <meta http-equiv="expires" content="0">

------解决方案--------------------
写一个过滤器过滤每一个页面 判断该页面是否存在session的信息 若不存在跳转!!!!
或者在每一个页面写上
Java code
<%
    String id = (String)session.getAttribute("idCard");
    if (null==id || id.equals("")) {
        out.print("<script language='javascript'>alert('请先登录系统!');window.location = 'user_login.jsp';</script>");
    }
%>

------解决方案--------------------
探讨

登录页面,禁止使用缓存

1.客户端缓存要在<head>中加入类似如下内容:
HTML code

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" conte……