aspose file tools*
The moose likes Servlets and the fly likes Cache Control Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cache Control" Watch "Cache Control" New topic
Author

Cache Control

kiran mahavir
Ranch Hand

Joined: Jan 09, 2001
Posts: 35
Hello all,
I have problem here. I am using jsp in my project.My problem is i shouldn't allow the user to navigate back.when he clicks the back button in the browser, he should get WARNING AGE EXPIRY message.So how to go about this.I used the following lines of code
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragma","no-cache");
It did not work.What do i need to do.Do i need to set some properties in the web server?
I am using tomcat3.2 version.
Thanx in advance
Kiran
[ January 16, 2004: Message edited by: Mark Spritzler ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

There is no sure fire way of handling this, I usually use

But there was also a suggestion in a previous thread that suggested that it might be possible to open a new browser window and make sure the previous window closes itself. I'd call that a bit yucky but it does solve the problem.
Dave.
shankar vembu
Ranch Hand

Joined: May 10, 2001
Posts: 309
Originally posted by David O'Meara:
There is no sure fire way of handling this, I usually use


This may work for pages that are getting served by your servlet. But what about static pages that are in fact getting served by the DefaultServlet. How do I make them un-cacheable. My problem is I have a page with many links to static resources say .mp3 files that I do not wanna cache... And I want to handle this at the server side(I have gone through the options available at the client side but feel would be better if this is handled at the server). How do I do this.. Is there some kinda management console where I can say "DO not cache my *.mp3 files" and the server i.e. DefaultServlet would add the respective headers whenever it serves an .mp3 file for me?? Or is there any other way out....
Regards
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Kiran. I removed the "Urgent" in your topic title. This way you can get more responses. Usually people skip over posts that say urgent.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cache Control