aspose file tools*
The moose likes Servlets and the fly likes Clearing cache in servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Clearing cache in servlets" Watch "Clearing cache in servlets" New topic
Author

Clearing cache in servlets

ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

I am trying to clear cache using servlets, to prevent duplicate records getting inserted. My servlets has some header variable information relating to username.
I am trying to clear the cache by using:
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);
But, this doesnt seem to work. Can anybody please help.

Thanks
[ February 08, 2006: Message edited by: ford Darcy Jr ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

That will not clear the cache. It will tell the browser not to cache the current "page".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

Thanks for the reply. Can you please tell me, what should I modify in that to get a solution.

Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

There is no way for a response to tell the browser to clear its cache. That is completely under user control.
ford Darcy Jr
Ranch Hand

Joined: Jan 26, 2005
Posts: 76
Hi,

Clearing cache using the response.setHeader("cache", "no-cache"), works fine on tomcat, but doesnt work when moved to weblogic server. Any idea what needs to be used on weblogic server for clearing cache to work.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

You are mistaking clearing the cache with preventing a page from being cached in the first place.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clearing cache in servlets
 
Similar Threads
Making a page expire
Struts 2 - logout - prevent back button
Servlet and IE Back Button...help!!
javascript