wood burning stoves 2.0*
The moose likes Servlets and the fly likes Cache control through response object. 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 » Java » Servlets
Bookmark "Cache control through response object." Watch "Cache control through response object." New topic
Author

Cache control through response object.

Yogesh Kapoor
Greenhorn

Joined: May 01, 2001
Posts: 6
Hi all,
I have a requirenent in my project where i have some screen for the user to fill in the data and stote them in the database.Now the problem is that in the biginning i present an empty form to the user(page 1 in browser) , the user fills in the data and hits on the save button, i save the data in a table and again show the same form to the user but this time filled in with the data he/she had wanted to save(page 2 in browser). Now what the user does is he/she presses the back button of the borwser and goes back to page 1 and sees the same empty form again.
To avoid this i used the following segemnt of code in my JSPs.......
<%
response.addHeader("Pragma", "NoCache");
response.addHeader("Cache-Control", "no-cache");
response.addDateHeader("Expires", 1);
%>
This works , but now when the user presses the back button after saving the record he/she gets the following warning page....
-----------------------------
Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.
To resubmit your information and view this Web page, click the Refresh button.
-----------------------------
Is there any more decent way to achieve this , so that the page 1 is removed from the history entirely..
Thanks
Yogesh
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Cache control through response object.
 
Similar Threads
Session problem or the browser problem?
Preventing Form Resubmission
Caching Problems with borwsers.
Warning: Page has Expired
Warning: Page has expired