This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Browser back button

 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I click back button in internet explorer, my application gives me a blank page.I get the following message:

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

I am using javascript to set the action of form and then submit the form.

I have kept some information in session object also.

I am unable to debug, why this is happening.

Please help..

Thanks,
Neeraj
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because...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.

More or less because you used javascript to submit the form and now that data is not available when you press the back button.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what can be done to avoid this except avoiding the javascript.

Thanks,
Neeraj.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
at my system..i think this is happening on this site also pls. somebody check and correct me..

Thanks,
Neeraj.
 
Author
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

More or less because you used javascript to submit the form and now that data is not available when you press the back button.

This would happen if you had no JavaScript in the page... happens to me all the time when I press back!

By pressing back, you are asking the POST request from your form to be re-submitted to the server. As the original message says, IE warns against this for POST methods only (since POST is non-idempotent) to prevent accidental submission of the data twice. If you really want to submit the data again, you can refresh while on the warning page.

Several patterns have been developed to ensure you don't see this, the most common being the Post/Redirect/Get... in essence it uses a GET redirect so the POST request is 'lost' from the browser's history, thus preventing re-submission of the form. For example, see:

http://www.theserverside.com/patterns/thread.tss?thread_id=20936
http://www.theserverside.com/news/thread.tss?thread_id=29758

I think Bear also wrote an article on this pattern a while ago as well, but I can't find a link to it right now...
 
Marshal
Posts: 67273
170
Mac Mac OS X IntelliJ IDE jQuery Java
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!