2

I need to implement a link on my page for Cancel which takes the user back to the page they were on.

I think that I can use a dynamic result to have the caller pass in the action I need to return to. This is described in: Struts2 - How to do dynamic URL redirects?

But each of the callers have different parameters to their page that specify the state they were in. How do I reset this state back to the action variables before I redirect to the previous action?

Roman C
  • 49,761
  • 33
  • 66
  • 176
Plex Lex
  • 23
  • 1
  • 4

1 Answers1

0

You need to save the state from the caller in the session, and pass the reference to it via the parameter of the action.

Using that parameter value you could retrieve the state back and reinitialize the action. It's easily done if you save a request URL of the caller in the session and redirect back to it on cancel redirect result by supplying the URL as a dynamic parameter.

You might also want to read Redirecting to another action with unknown amount of parameters in Struts 2.

Roman C
  • 49,761
  • 33
  • 66
  • 176