You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by alexworden <al...@gmail.com> on 2007/11/20 21:51:41 UTC
[S2] How to forward to another struts mapping
Hi,
I'm trying to process a request to URL-A with Action-A, then display a home
page of URL-B in Struts 2. However, in order to display the view of URL-B, I
need to invoke Action-B first. I also want any ActionErrors from Action-A to
be present in the view of URL-B.
How do I do this? It used to be simple in Struts-1, but I can't figure it
out for Struts2.
Thanks,
Alex
--
View this message in context: http://www.nabble.com/-S2--How-to-forward-to-another-struts-mapping-tf4846285.html#a13865418
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2] How to forward to another struts mapping
Posted by Omkar Patil <os...@gmail.com>.
You can do it in two ways -
1. Action chaining using result type="chain" - But as a rule, action
chaining is not recommended.
2. Using Redirect-after-post pattern. You'll need to define result
type="redirectAction". For example, if you need to redirect from ActionA to
ActionB, your struts2 config will look like -
<action name="ActionA" class="example.Test">
<result type="redirectAction">ActionB</result>
</action>
While redirecting, you'll need to persist any data that is needed for
subsequest request temporarily on the server side (flash scope in popular
lingo :^) ) . You might want take a look at the Scope plugin which provides
such support out of the box.
- Omkar
alexworden wrote:
>
> Hi,
>
> I'm trying to process a request to URL-A with Action-A, then display a
> home page of URL-B in Struts 2. However, in order to display the view of
> URL-B, I need to invoke Action-B first. I also want any ActionErrors from
> Action-A to be present in the view of URL-B.
>
> How do I do this? It used to be simple in Struts-1, but I can't figure it
> out for Struts2.
>
> Thanks,
>
> Alex
>
--
View this message in context: http://www.nabble.com/-S2--How-to-forward-to-another-struts-mapping-tf4846285.html#a13873782
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org