jsp 页面设置no-cache
来源:互联网 发布:php订单管理系统源码 编辑:程序博客网 时间:2024/06/03 15:36
jsp 页面设置no-cache
在jsp页面里加入如下代码:
<%
response.setHeader("Cache-Control","no-cache");//HTTP 1.1
response.setHeader("Pragma","no-cache");//HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
response.setHeader("Cache-Control","no-cache");//HTTP 1.1
response.setHeader("Pragma","no-cache");//HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
在有些应用中要求JSP不缓存数据,每次都从web服务器重新生执行(非内存中的数据)后生成的数据取出来显示在客户机上。
这就要在JSP上强制不缓存,需要在JSP中加入以下代码
%@ page contentType="text/html;charset=gb2312" languang="java" buffer="none" %>
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<%
//设置缓存为空
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
//设置缓存为空
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
<%
if(request.getProtocol().compareTo("HTTP/1.0")==0)
response.setHeader("Pragma","no-cache");
else if(request.getProtocol().compareTo("HTTP/1.1")==0)
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires",0);
%>
if(request.getProtocol().compareTo("HTTP/1.0")==0)
response.setHeader("Pragma","no-cache");
else if(request.getProtocol().compareTo("HTTP/1.1")==0)
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires",0);
%>
- jsp 页面设置no-cache
- HTML 设置页面缓存no-cache
- JSP expire/no cache
- 设置meta标签 清除页面缓存,如:<meta http-equiv="Cache-Control" content="no-cache"/>
- 设置meta标签 清除页面缓存,如:<meta http-equiv="Cache-Control" content="no-cache"/>
- jsp设置页面过期
- jsp设置页面过期
- JSP页面设置编码
- JSP页面设置全局变量
- JSP页面设置编码
- JSP页面设置编码
- JSP页面编码设置
- php header()设置页面Cache缓存
- No Cache
- no cache
- “Pragma:No-cache”标记可能无法防止页面被缓存
- JSP 页面中 编码设置
- jsp页面禁止缓存设置
- B2C不能承受之痛——RMA
- xcode4中build Settings常见参数解析
- 线段树(区间树)
- java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=125
- 如何手动配置C#开发环境。
- jsp 页面设置no-cache
- debian中开启语法高亮显示
- BOOTM浅析
- 广东佛山财政局长:政府要敢于举债-举债-政府-债务
- android网络电话源码
- NSDateFormatter setDateFormat 自定义日期/时间格式
- 一些有用的东西集合
- 解决Cent OS在Virtual PC中花屏和鼠标使用问题
- 织梦后台更改rss、sitemap生成路径