Stop page caching in J2EE
4
This should stop your JSP page being cached by browsers and proxies.
It tries to cover all bases, just stick it at the top of any JSP page.
If your entire web application requires this, it would be much more economical to write a J2EE Filter, and run this code for each request before chaining on to the next filter..
It tries to cover all bases, just stick it at the top of any JSP page.
If your entire web application requires this, it would be much more economical to write a J2EE Filter, and run this code for each request before chaining on to the next filter..
<%
// Set to expire far in the past.
response.setHeader("Expires", "Sat, 2 May 1992 12:00:00 GMT");
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
%>






There are currently no comments for this snippet.