1, 使用java提供的方法,在jsp或者servlet中都可以
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
2, 使用HTML标记,如下面:
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</HEAD>
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
2, 使用HTML标记,如下面:
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
</HEAD>
解决方案 »
- myeclipse web项目中 引入的很多jar包无法展开
- 怎么用js根据后台传过来的参数不同隐藏菜单中个别的选项?求高手指点,具体代码。
- 很简单的try catch finally代码,但返回值搞不懂
- JS里的一个函数里执行ACTION和取得ACTION执行后的值
- jsp连接数据库文件mdb问题!
- 求助:JSP连接不上数据库
- 求小说类型的网站的模板
- 总在Refresh页面,但是session还会过期?怎么回事?
- Tomcat的默认页路径是webapps\ROOT,怎样才能改为其它路径?
- android模拟登录后带cookie访问受保护的网站比如学校教务网
- 与数据库的连接自动关闭是怎么回事?
- 100分求jive2.0以上的源代码,收到后马上给分。谢谢
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
这个应该是可以的
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
....
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
...
}
用location.href="index.jsp?start="+Math.random()
这样就会强制从服务器读取
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache "
%>
强制浏览器重新访问服务器下载页面,而不是从缓存读取页面。