File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cache Control" Watch "Cache Control" New topic

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
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
[ January 16, 2004: Message edited by: Mark Spritzler ]
David O'Meara

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.
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....
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

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

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Cache Control
It's not a secret anymore!