This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

How to prevent form submits when using back (browser history)Page Title Module

Comment

I'm not familiar with what Spring has done with the JSP layer recently, but quite a while ago Struts had implemented a mechanism that addresses this. When the page is rendered, a token value is allocated and the id for that token is rendered in a hidden field in the JSP. When the form is submitted, the action verifies that the token value equals the value submitted from the hidden field, and rejects it if it's not the same. After it makes that check, it removes the allocated token so that a resubmit after a back press will fail the verification.

This sounds fine, but it would still not adress the issue, if the user pressed the back button..

Post-Redirect-Get is designed/worked-out especially for this usecase... Because due to this the browser doesn't cache the post anymore and hence you can simply press back without resubmitting the form.. I suggest reading a bit more on the topic...