This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with cache and session" Watch "Problem with cache and session" New topic
Author

Problem with cache and session

Davide Alagna
Greenhorn

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.setHeader("Cache-Control","no-cache");
response.setHeader("Cache-Control","no-store");
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:

//response.setHeader("Cache-Control","no-cache");
//response.setHeader("Cache-Control","no-store");

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.
David
Marc Peabody
pie sneak
Sheriff

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with cache and session
 
Similar Threads
roblem when caching with Internet Explorer 6.0
Re-login issue after click on browsers back button and press refresh
Disabling Back Button in a browser
Disabling Back Button in a browser
prevent page caching