How to remove page caching using java

817 Views Asked by At

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

1

There are 1 best solutions below

0
On

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">