This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

browser cache problem  RSS feed

 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I make sure that on every request the browser don't use cache and make a server trip. How it can be implemented in the action class or in jsp?
 
Sudipen Maggi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or in simple words my problem is....I have to disable caching at client side so that everytime my page is fetched from the server.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't disable client-side caching, but you can give hints to the browser by using response headers. See http://faq.javaranch.com/java/NoCacheHeaders for details. If that doesn't work you -and it should-, a common workaround is to append a time stamp to each page link being generated, like "http://www.myserver.com/myApp/myJsp?ts=1234567890"
 
Sam Mites
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make the screen not to be cached.. add this in the end of the display action just before forwarding...............

response.addHeader("Pragma","no-cache");
response.addIntHeader("Expires",-1);
response.addHeader("Cache-Control","no-cache, must-revalidate");
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!