| 风信Java论坛 ›› J2EE/Java Web 讨论交流中心 ›› Q: ("Cache-Control","no-cache");是干什么用的?目的是什么? | 登录 -> 注册 |
|
1F Q: ("Cache-Control","no-cache");是干什么用的?目的是什么? 唧唧 Post by : 2008-10-19 20:19:40.0
Q: response.setHeader("Cache-Control","no-cache"); 是干什么用的?目的是什么? 1. response.setHeader("Cache-Control","no-cache"); This is used to prevent the browser from caching your dynamic content generated by a JSP or Servlet. You set this attribute in the HTTP header of the response object which would tell the browser not to cache this content. So everytime you request the page again, the browser would make a new request, instead of showing you a cached page. 2.使用服务器端控制AJAX页面缓存: 3.Cache-Control头域 |
|
2F 唧唧 Post by : 2008-10-19 20:21:19.0
response.setDateHeader("Expires", 0);
expires是response的一个属性 它可以设置页面在浏览器的缓存里保存的时间 超过设定的时间后就过期 过期后再次浏览该页面就需要重新请求服务器发送页面数据 如果在规定的时间内再次访问次页面 就不需从服务器传送 直接从缓存中读取 |
| 风信Java论坛 ›› J2EE/Java Web 讨论交流中心 ›› Q: ("Cache-Control","no-cache");是干什么用的?目的是什么? | 登录 -> 注册 |