This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes Browser back/forward problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Browser back/forward problem" Watch "Browser back/forward problem" New topic
Author

Browser back/forward problem

Devi Taruni
Greenhorn

Joined: Sep 03, 2008
Posts: 11
Hello,

I wanted to know are there any cases where when you click on browser back/forward button it makes a call to the server? I am really surprised to see the page submission happening whenever browser back/forward button is hit in our application.

I am working on an application which has been implemented in Struts(DispatchAction concept), Tiles. As far as my knowledge is concerned, browser buttons never make a call to the server, instead all the visited pages are just pulled from cache and displayed but my application is behaving quite opposite way, it makes a call to the server on every hit on browser-back/forward buttons and results in an inconsistent behaviour.
After searching for quite sometime, i found these lines :
Another issue is caching pages when browsers navigate backwards --
browsers are more likely to silently re-submit a form request with a GET method than with a POST request.

source:
http://lists.nyphp.org/pipermail/talk/2003-February/002327.html

Do you think the problem is with the request submission or in usuage of Struts Dispatch Action?

Can someone help?
TIA
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

"Devi", you have previously been warned on multiple occasions regarding adjusting your display name to meet JavaRanch standards. This is not optional, and this is your final warning. Adjust your display name to comply with the required standards prior to your next post.

Your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Failure to comply will result in the removal of your account.

bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by Devi:


I wanted to know are there any cases where when you click on browser back/forward button it makes a call to the server?



As far i know.. the Answare is YES. i did experiment on this recently...i found that when you paste some code like



to prevent browser cache ... then if you click back/forward button...it reach server...

you can not disable browser back button but you can controll.


then what you read from the link which you gave is correct... always use POST method to submit the forms
Srikanth Nutigattu
Ranch Hand

Joined: Oct 30, 2007
Posts: 114
To add one more point, the "GET" request should not "Modify the State", it means even if you request for multiple times the state should not be modified and hence will not lead to inconsistencies....

Hence, if you are doing a FORM submissions, you better use "POST" as it modifies the "State".

HTH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Browser back/forward problem
 
Similar Threads
forward not redirect, on click of button
Page expired error when browser back button is hit
Duplicate form submission - Synchronizer Token Pattern
Yet another caching trouble
problem using html:link