IE is notoriously aggressive when it comes to caching pages.
The following works for Netscape on all platforms and IE3,4,5 on
Windows. IE4.x on the Mac apparently has a bug that causes it
to cache pages regardless of the HTTP headers (it even ignores
explicit user settings to disable caching).
response.setHeader( "Pragma", "no-cache" );
response.setHeader( "Cache-Control", "no-cache" );
response.setHeader( "Cache-Control", "no-store" );
response.setDateHeader( "Expires", 0 );
The first three normally just control proxy caches but it doesn't hurt
to be sure. Your webserver should normally set the "Date" header
value automatically, but if it doesn't then you should set that as well:
long now = System.currentTimeMillis();
response.setDateHeader( "Date", now );
Note that you should really use these only for GET requests, otherwise
Netscape will attempt to re-POST when resizing the browser window
for example. In general, inhibiting caching for POST requests causes
a lot of headaches with Netscape.
I hope this helps,
- Claude
P.S. This question comes up often enough that it really should be in
the servlet FAQ. It is made more difficult by the fact that the interpretation
of these headers by browsers is by no means standardized or even
coherent.
At 12:54 PM 3/29/99 , you wrote:
>Hi there.
>
>I'm having a problem with IE. I have servlet that presents some information to the
>user. It also has a link that will allow then to change through another servlet. Upon
>return to the first servlet IE displays the original information and does not reflect
>the information that was changed on servlet B. I assume it's reading servlet A from
>cache as this does not happen with Netscape. I need to know how to get IE not to read
>from cache but to re-run the servlet.
>
>Any help would be greatly appreciated.
>Patrick
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
_____________________________
Claude Zervas
Principal Computer Scientist
Uniplanet LLC, Seattle
http://www.uniplanet.com
_____________________________
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html