Reputation: 631
I have inherited a Java website that uses Struts 1. Currently if the brosers back button is pressed midway through a journey they get a 'Webpage has expired' error.
From my limited understanding, this seems to be a flaw in the design of Struts - every page is a form. Is there anyway to get around the problem, or would the only way be migrating to a different MVC framework (struts2, springMVC)?
Upvotes: 4
Views: 4503
Reputation: 16311
This is not a Struts problem, really. Apparently, the guy who built this did not believe in the Post/Redirect/Get pattern, and instead serves up a page directly in response to a form submission.
You can change this behavior by applying redirect="true"
to your action forwards:
<action ... >
<forward name="success"
contextRelative="true"
path="/moduleB/index.do"
redirect="true"/>
</action>
See the Struts user guide for more information.
Upvotes: 9
Reputation: 9705
I don't think there's anything inherent in struts that does that. It sounds like the previous developer tried to create some kind of wizard. The proper way to do it, would be to store the pending results in the wizard in a session, and do a full redirect after every form submission.
Upvotes: 1