This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 751
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: page expired when clicking back button of browser.
 
Similar Threads
sql statement executes in Toad, not in app
Refresh in browser
is there any funtion in jsp like server.transfer in asp
Bear's Frontman, suggested way to pass a session object.
JSF Questions