-1
response.setHeader("Cache-Control","no-store"); 
response.setHeader("Pragma","no-cache"); 
response.setDateHeader ("Expires", 0);
mprabhat
  • 20,107
  • 7
  • 46
  • 63
Sonu
  • 5
  • 1

2 Answers2

0

These cache control settings can be used for pages that you do not want the contents of stored locally by the browser. Most web developers DO NOT want to use these because they may negatively impact performance. Examples of when you may want to use it is when you have extensive, dynamic resources.

The expires tag tells the browser that the page expires after being rendered. "Setting EXPIRES to 0 may thus be used to force a modification check at each visit."

Orbiting Eden
  • 1,522
  • 13
  • 16
0

You need to set the appropriate HTTP header attributes to prevent the dynamic content output by the JSP page from being cached by the browser. You can do this by executing the following scriptlet at the beginning of your JSP pages to prevent them from being cached at the browser. You need both the statements to take care of some of the older browser versions.

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

The same effect can be achieved by using meta tags in the HTML header:

<meta http-equiv="Pragma" content="no-cache">
 <meta http-equiv="Cache-Control" content="no-cache">
 <meta http-equiv="Expires" content="Thu, 01 Dec 2011 00:00:00 GMT">

You can refer here for more information.

Community
  • 1
  • 1
Jainendra
  • 24,713
  • 30
  • 122
  • 169