方法总结:
1.在jsp头增加下面代码,没有实现;
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">
2.用js强制刷新,可以实现刷新,但是正常访问时刷新了两次
window.onload = function(){
if(window.name!="hasLoad"){
location.reload();
window.name = "hasLoad";
}else{
window.name="";
}
}
3.java代码,在jsp中增加下面java代码,可以实现刷新
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store");