JSP/HTML page cache

Put following scriptlet at the beginning of the JSP to prevent output caching

<%
response.setHeader( "Cache-Control", "no-cache,no-store"); //HTTP 1.1
response.setDateHeader( "Expires", 0 ); //prevent caching at the proxy server
response.setHeader( "Pragma", "no-cache" ); //HTTP 1.0
%>

It is always good to set Pragma header too, in case HTTP 1.0 is used.

In HTML
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">


References:
http://www.jsptube.com/examples/jsp-no-cache.html
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
http://en.wikipedia.org/wiki/List_of_HTTP_headers
HTTP1.1 http://www.gz-htsb.cn/News/A4/200905/2301_7.html
http://www.faceye.com/gulong/article/4028808323a982290123e6f497db02c1.html

http://blogs.imeta.co.uk/JDeabill/archive/2008/07/14/303.aspx

你可能感兴趣的:(html,jsp,cache)