File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem with cache and session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with cache and session" Watch "Problem with cache and session" New topic

Problem with cache and session

Davide Alagna

Joined: Feb 16, 2005
Posts: 5
Hi all,
I have a big problem when caching with Internet Explorer 6.0. In order to prevent caching to all my Struts Actions, I have created a class called BaseAction that implements cache control:

response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");

All my Struts Actions extend my BaseAction class. The problem is that, when I click the back button, IE shows the error page "The page cannot be displayed".

The problem does not occur if I disable the first two headers:


In order to see what IE does when I click the back button, I have made a snoop of tcp/http traffic. IE does not send anything (neither a bite!) to the server when I click the back button.
Furthermore, the problem does not occur when using Firefox 1.0.3 (it shows the message "the page contains POST data - do you want to resend data?").

Can anybody help me please? Thanks in advance.
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

It's working properly, it's just not what you expected.

I believe what you are looking for is the functionality of the PRG Pattern.

A good workman is known by his tools.
wood burning stoves
subject: Problem with cache and session
jQuery in Action, 3rd edition