File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSP
Bookmark "Browser back/forward problem" Watch "Browser back/forward problem" New topic

Browser back/forward problem

Devi Taruni

Joined: Sep 03, 2008
Posts: 11

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.


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

Can someone help?
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63857

"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.

JavaRanch Sheriff

[Asking smart questions] [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 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".

I agree. Here's the link:
subject: Browser back/forward problem
It's not a secret anymore!