You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Morten <li...@kikobu.com> on 2003/10/13 18:36:31 UTC
Redirect w. generic parameter using action forward
Hi,
Is it possible to add a parameter to the redirect when redirecting
via an action forward?
Eg.
<action ... type="my.struts.Action">
<forward name="success" path="/streamingservlet/" redirect="true"/>
</action>
In my.struts.Action I wish to set the parameter file=foo.txt parameter
in the redirect request, ie. effectively, I want the following to
happen:
response.sendRedirect("/streamingservlet/?file="+fileName);
Can (should) this be done with actionMapping.findForward("success");
or do I need to forward to a JSP which in turn reads the fileName as
a request attribute and does the forward?
Thanks in advance,
Morten
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Redirect w. generic parameter using action forward
Posted by Morten <li...@kikobu.com>.
Robert Taylor wrote:
> You can do this in your action class manually:
>
> ActionForward forward = mapping.findForward("success");
> String path = forward.getPath();
> path += "?file=" + fileName; // url encoded file name
> return new ActionForward(path, true); // redirect
Ooh, thanks.
> There are more slick ways to do this, but this should put you
> on the right track.
What do you mean "more slick ways"? By configuration? I've looked at the
API but don't really see any shortcuts.
Thanks for the help,
Morten
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: Redirect w. generic parameter using action forward
Posted by Robert Taylor <rt...@mulework.com>.
You can do this in your action class manually:
ActionForward forward = mapping.findForward("success");
String path = forward.getPath();
path += "?file=" + fileName; // url encoded file name
return new ActionForward(path, true); // redirect
There are more slick ways to do this, but this should put you
on the right track.
robert
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org]On Behalf Of Morten
> Sent: Monday, October 13, 2003 12:37 PM
> To: struts-user@jakarta.apache.org
> Subject: Redirect w. generic parameter using action forward
>
>
>
> Hi,
>
> Is it possible to add a parameter to the redirect when redirecting
> via an action forward?
>
> Eg.
>
> <action ... type="my.struts.Action">
> <forward name="success" path="/streamingservlet/" redirect="true"/>
> </action>
>
> In my.struts.Action I wish to set the parameter file=foo.txt parameter
> in the redirect request, ie. effectively, I want the following to
> happen:
>
> response.sendRedirect("/streamingservlet/?file="+fileName);
>
> Can (should) this be done with actionMapping.findForward("success");
> or do I need to forward to a JSP which in turn reads the fileName as
> a request attribute and does the forward?
>
> Thanks in advance,
>
> Morten
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org