為了防止瀏覽器緩存當前訪問的JSP動態(tài)頁面,可以采用如下的方式進行設(shè)置:
<%
// 將過期日期設(shè)置為一個過去時間
response.setHeader("Expires", "Sat, 6 May 1995 12:00:00 GMT");
// 設(shè)置 HTTP/1.1 no-cache 頭
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// 設(shè)置 IE 擴展 HTTP/1.1 no-cache headers, 用戶自己添加
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// 設(shè)置標準 HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
%>
J-CN工作室
www.j-cn.org