如何使用java清除浏览器缓存 [英] How to clear browser cache using java

查看:251
本文介绍了如何使用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.

这篇关于如何使用java清除浏览器缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆