日期:2014-05-18  浏览次数:20668 次

请问怎么实现一个管理系统的完整退出?
点击left.jsp   中的“安全退出”,返回到   login.jsp   ,
随即再点击“后退”,不会再进到系统中,不能再对系统做任何操作!

------解决方案--------------------
还有就是强制禁用IE的缓存,防止别人使用“后退”,看到一些敏感信息。

------解决方案--------------------
配置一个过滤器Filter
当退出时清掉session
然后在过滤器里对除login.jsp以外的所有页面过滤
------解决方案--------------------
我都按照上面的说法配置了,但是按了后退后,会到SERVLET,再点刷新,又进去了

我的过滤器是这样的

public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {


HttpServletRequest req = (HttpServletRequest)request;
HttpServletResponse res = (HttpServletResponse)response;

res.setHeader( "Cache-Control " , "no-cache " ); //Forces caches to obtain a new copy of the page from the origin server
res.setHeader( "Cache-Control " , "no-store " ); //Directs caches not to store the page under any circumstance
res.setDateHeader( "Expires " , 0); //Causes the proxy cache to see the page as "stale "
res.setHeader( "Pragma " , "no-cache " ); //HTTP 1.0 backward compatibility

HttpSession session = req.getSession();

if(session.getAttribute( "uid ") != null) {
chain.doFilter(req, res);
}
else {
request.getRequestDispatcher( "/index.jsp ").forward(req, res);
}

}


后面退出页面的代码是:

<%@ page language= "java " contentType= "text/html; charset=UTF-8 "
pageEncoding= "UTF-8 "%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=UTF-8 ">
<title> 退出系统 </title>
</head>
<body>
<h1> WAP后台管理--> 退出系统 </h1>
<hr>
<br>
<%
session.setAttribute( "uid ",null);

session.invalidate();

response.setHeader( "Refresh ", "5;URL=/huayimana/index.jsp ");
%>
<h2> 你已经退出本系统 </h2>
<h2> 系统将在5秒后跳转回登录页 </h2>
<h2> 如果没有跳转,请按 <a href= "/huayimana/index.jsp "> 这里 </a> </h2>

</body>
</html>



------解决方案--------------------
asmetoyou(KaKa):
配置一个过滤器Filter
当退出时清掉session
然后在过滤器里对除login.jsp以外的所有页面过滤


----------建议用这种方法实现,就不需要在每个页面去做验证了