This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

remove cache from java code in jsp  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sudarshan Reddy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!