Friday, 28 February 2014

How to prevent the output of JSP or SERVLET pages from being cached by the browser?

Execute following scriptlet at the start of JSP pages to prevent them from being cached at the browser. (Take care of few of the older browser versions)

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

No comments:

Post a Comment

Thank you so much for providing your valuable feedback. I will will look into them and update my skills & technologies accordingly.