Struts 1 is not convenient with a browser button: any solutions?

I have inherited a Java website that uses Struts 1. Currently, if the bead return button is clicked in the middle of the path, they get the "Expired Webpage" error message.

From my limited understanding, this seems like a flaw in the Struts design - each page is a form. In any case, in order to get around the problem, or could we only go to another MVC structure (struts2, springMVC)?

+4
source share
2 answers

This is actually not a Struts problem. Apparently, the guy who built this did not believe in Post / Redirect / Get , but instead serves the page directly in response to submitting the form.

You can change this behavior by applying redirect="true" to your action:

 <action ... > <forward name="success" contextRelative="true" path="/moduleB/index.do" redirect="true"/> </action> 

See the Struts User Guide for more information.

+8
source

I do not think this is something inherent in struts. It seems that the previous developer tried to create a kind of wizard. The right way to do this is to store the pending results in the wizard in the session and perform a full redirect after each form submission.

+1
source

All Articles