设置浏览器不缓存
为了指示IE浏览器(客户端)不要缓存页面,服务器端的程序可以编写如下:response.setHeader(“Cache-Control”, “no-cache”);
response.setHeader(“Pragma”, “no-cache”);作用相当于上行代码,通常两者合用
public static void setNoCache(HttpServletRequest request, HttpServletResponse response){
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);
}