aspose file tools*
The moose likes Servlets and the fly likes Servlet  and IE Back Button...help!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet  and IE Back Button...help!!" Watch "Servlet  and IE Back Button...help!!" New topic
Author

Servlet and IE Back Button...help!!

Medha kamat
Greenhorn

Joined: Aug 22, 2002
Posts: 21
My reporting system generates reports via a Servlet.Servlet streams all reporting html to browser.There is one more servlet for styling called as Style servlet.
There is one scenario where reports are 'drill down'..meaning if u click on report text it will open a new report.If u select to open this report in a new window there is no problem.But if u open a drill down report in same window and try to go back with back button (right click and back),it goes to previous report but without any styles.
I noticed that it's not invoking a Style servlet at all.Why?
I wrote a simple javascript function to reload this servlet..still it's not working..it's not at all making a call to that servlet.
if i write path/Style in address bar it invokes Style servlet.then why it isn't invoking it from my report??
I have a simple link tag whose href attribute calls a Style servlet.
<link rel="stylesheet" type="text/css" href="{$context}/Style"/>
I have tried diff things..i couldn't make it work..is there anybody out there who can help me ..suggest me something..help!!
thanks in advance
Medha
Parag K
Greenhorn

Joined: Sep 17, 2002
Posts: 4
hi
this may not be relevant also.. but have you considered the possibility of the contents being stored in the cache somewhere? either at the browser level or at the proxy server level.
i am not sure about this..but that was the problem in my case sometime back.
hope that helps,
Parag
Medha kamat
Greenhorn

Joined: Aug 22, 2002
Posts: 21
Hi
Thanks for the reply.
Well yes it's caching it on browser level.And when Style servlet streams it ,it's contenet type is set to text/plain (because it's a css).In browser cache it is storing this as a text file.
i suspect when i am going back it tries to reterive it from cache.Since it is stored as a text file in cache but actually it's referncing it as /Style (call to a Style servlet) in link tag..it's getting confused ..what shall i do???
Thanks
Medha
sampy jagan
Ranch Hand

Joined: Sep 17, 2002
Posts: 34
For stopping the caching of the page in the browser use the "pragma:nocache" in the header, it tells the server not to return a cached copy but to ensure that the information is as fresh as possible...
Medha kamat
Greenhorn

Joined: Aug 22, 2002
Posts: 21
Hi
Thanks for the suggestion.
I did something like this in my servlet code
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-control", "no-cache");
response.setDateHeader("Expires",0);
still it's caching it and trying to get it from cache when i go back in browser.
what am i doing wrong?
Medha
sampy jagan
Ranch Hand

Joined: Sep 17, 2002
Posts: 34
Then try using HTTP Headers instead. pragma is not effecient in handling proxy caches. Check out the url.
http://www.mnot.net/cache_docs/#EXPIRES
Regards
jagan
sampy jagan
Ranch Hand

Joined: Sep 17, 2002
Posts: 34
Note while using Expires attribute :
The only value valid in an Expires header is a HTTP date; anything else will most likely be interpreted as 'in the past', so that the object is uncacheable. Also, remember that the time in a HTTP date is Greenwich Mean Time (GMT), not local time.
For example:
Expires: Fri, 30 Oct 1998 14:19:41 GMT
 
 
subject: Servlet and IE Back Button...help!!