Say there are 3 pages A, B, C with : A having links to B & C. B having a link to C. A -> B, C B -> C
The route of reaching C determines the return button action in page C. So if one reaches page C from A, the return should take back to A. But SAME return button should take back to page B, if approached from B.
Joined: Apr 23, 2006
I looked at this article which describes the "Back page" struts problem.
One simple solution would be to include a "returnTo" parameter in the link that contains the URL to return to after the link. You will have to "escape" some of the charaters such as "/" so that they don't mess up the URL, but you can use the java.net.URLEncoder class for this.
Then in the Action class, simply retrieve the returnTo parameter. You can then dynamically create a forward that refers to it, and the return that forward. Example: