wood burning stoves 2.0*
The moose likes Servlets and the fly likes page expired when clicking back button of browser. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "page expired when clicking back button of browser." Watch "page expired when clicking back button of browser." New topic
Author

page expired when clicking back button of browser.

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 755
hi

in my web application

i have one jsp view (view1.jsp)which contains 2 text fields...

when user fills up value and click on submit button of view1.jsp
the request goes to my servlet and processes the request and add 2 attributes to session and forwards the response using request despetcher. to view2.jsp which display data in table format...

while the user is on view2.jsp which display data in table format... and clicks back button... it get page expired... and when i click refresh button... the page with 2 text box comes... which should ideally displayed on clicking back button...

is there any perticular reason for my application's such behaviour ???

what are the steps i need to take to prevent this...

Thanks in advance...


Jigar Naik


Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Your pages are not cached in the browser , that is the reason for such behaviour.


Rahul Bhattacharjee
LinkedIn - Blog
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

This is also a good thing. Otherwise, clicking the back button would result in a form being re-submtitted.

Look into the post-redirect-get pattern to insure that this doesn't happen.
There is an example in the JSP faq section.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
Don't get me started about those stupid light bulbs.
 
subject: page expired when clicking back button of browser.