1

My web pages are cached even when i used session.invalidate method. How can i remove caching of pages using java coding?

jmj
  • 237,923
  • 42
  • 401
  • 438
Chirag Tayal
  • 459
  • 1
  • 6
  • 14
  • http://stackoverflow.com/questions/511144/how-to-instruct-web-browsers-not-to-cache-pages – jmj Feb 03 '11 at 13:47

1 Answers1

5

You need to set the appropriate headers in your pages so that they are not cached by the browser:

response.setHeader("Cache-Control","no-cache"); 
response.setHeader("Pragma","no-cache"); 
response.setDateHeader ("Expires", -1);

and

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> 
dogbane
  • 266,786
  • 75
  • 396
  • 414