如何使用java清除浏览器缓存
问题描述:
我在会话中遇到问题。当我注销会话是
结束但是当按下浏览器后退按钮时我得到上一页。我正在使用jsp servlet技术,我的注销代码如下:
I have a problem in sessions. When ever I logout the session is ended but then when the browsers back button is pressed I am getting the previous page. I am using jsp servlet technology and my code for logout is given below
request.getSession().invalidate();
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma","no-cache");
response.sendRedirect("home.jsp");
任何人都可以告诉我问题在哪里以及这个问题的解决方案是什么?
can anybody tell me where is the problem and what will be the solution for this problem?
答
您是否仅在注销页面上设置缓存标头?如果是这样,您需要将这些内容放在每个页面上,因为您来自的页面没有它们并且将被缓存。
Do you set the cache headers only on the logout page? If so, you need to put those on each page since the page you were coming from does not have them and will be cached.