wood burning stoves*
The moose likes JSP and the fly likes remove cache from java code in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "remove cache from java code in jsp" Watch "remove cache from java code in jsp" New topic
Author

remove cache from java code in jsp

Sudarshan Reddy
Greenhorn

Joined: Aug 23, 2007
Posts: 20
Hi
i want to remove cache and not to allow the user to to go back when the user click on the back button in the browser

how can i achieve this from java code?


With Regards<br /> <br />Sudarshan Reddy
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

In the future, you should post JSP related questions to the JSP forum.

This question is very common over there in the JSP forum, you should see many answers if you search it, or use Google to search for JSP cache control. As a summary, there are several cache control headers you need to add to every response sent from your server that prevent caching the page.


Steve
Sudarshan Reddy
Greenhorn

Joined: Aug 23, 2007
Posts: 20
i am not able to do this in internet Explorer where as it is not working file in Mozilla when i am accessing the application in different browsers

can you tell me the reason and help me

this is the code that i am using in my jsp

response.setDateHeader("max-age", 0);
response.setDateHeader("Expires", 0);
response.setIntHeader("max-age", 0);
response.setHeader("Cache-Control","no-cache");
response.addHeader("Cache-Control","no-store");
response.setHeader("Pragma", "no-cache");
response.setIntHeader ("Expires", -1);
response.addHeader("cache-Control", "private");
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4167
    
  21

Which browser(s) is it not working in? What does it mean by 'not working?' Where are you putting that code? Have you done the search I suggested and read some of the several hundreds of threads on this subject?

You should also read this javaworld article on the subject. Make sure you also read the article referenced in the first paragraph of the provided link, since it provides the backbone for what the 'revisit' article is based on.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: remove cache from java code in jsp
 
Similar Threads
help with a clustered environment
Struts Page Expired
enable Browser Back Button
Warning: Page has Expired
Getting logout to work effectively in jsp