Struts Redirect w/Parameters Part 2

June 5, 2006

In an earlier post, I described a class to handle redirects in Struts and passing parameters along. That technique is not necessary; as of Struts 1.2.7, you can use the ActionRedirect class instead.

Here's a basic example from inside the execute method in an Action.
ActionRedirect redirect = new ActionRedirect(mapping.findForward("success")); redirect.addParameter("myparam","myvalue");
redirect.addParameter("something","fornothing");
redirect.addParameter("answer","42");
return redirect;

The ActionRedirect class is basically the same as my ForwardParameter class and is probably preferable.

11 Responses to “Struts Redirect w/Parameters Part 2”


  1. […] EDIT: This article has been superseded by a newer article. Posted by organicveggie Filed in Java, Web Development, Struts […]

  2. Galaher Johan Says:

    ActionRedirect is something i have to build or it’s something i can include in my project?
    I am working with struts and i am very new in the field.


  3. ActionRedirect is a class that is part of the Struts Action 1 framework as of Struts 1.2.7.

    http://struts.apache.org/struts-action/struts-core/apidocs/org/apache/struts/action/ActionRedirect.html

  4. gumic Says:

    thanks for the hint!

    btw: previous part is indexed by google as first, so i was afraid i’d have to implement my own redirect class ;).

  5. rob Says:

    Exactly what I needed – many thanks!

  6. Justin Coyne Says:

    Great tip. Thanks for following up your previous post on this topic.

  7. Sateesh Says:

    Nice artice…. This is what Im looking for….But the redirect uses GET method to send the parameters as it shows the query string in the browser… is there any way to send in POST method?


  8. and just what are you supposed to do if your querystrings are dynamic or unknown at the time (ie: redirect to the sending url post completion)? You can’t do it. Struts is a load of old bollocks!

  9. Nicolas Grolleau Says:

    Thank you for this page, very helpfull!

  10. RD Says:

    Thanks a ton! This was a great help! đŸ˜‰

  11. Mehdi Says:

    thnx a lot, you made my day sir đŸ˜€


Leave a comment