You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by lbastil <ba...@gmx.de> on 2007/10/29 17:03:51 UTC

[s2] forward to another action?

I know about the possibility to redirect to another action by result type
"redirect-action"

But this does a redirect (HTTP 302).

Is the same possible with a "forward" instead of redirect?

Thank you very much in advance,
basti
-- 
View this message in context: http://www.nabble.com/-s2--forward-to-another-action--tf4712685.html#a13470792
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] forward to another action?

Posted by lbastil <ba...@gmx.de>.
Thank you very much for this hint,
it is exactly what I meanwhile have implemented as fallback.

Only disadvantage in comparison to an ognl expression is that in case of
change I have
to change action (code) and recompile ...

What do you mean with overly-complex in detail?

the approach trying to catch as much actions with one action configuration?
(*_*_*)

I read about this as "best practice" in some struts documentation ...
Would you recommend from your experience other style?

Thanks again,
basti


newton.dave wrote:
> 
> --- lbastil <ba...@gmx.de> wrote:
>> can I use in struts.xml complex ognl statements?
> 
> Well... yes, but there's no reason to in this usecase.
> 
>> <action name="*_*_*" method="{3}" class="{2}Action">
>>   <result name="back" type="redirect-action">
>>     {1}_<target>_show.action
>>   </result>
> 
> Expose a "target" property in your action and do the
> lookup there; the destination of your redirect-action
> would then be:
> 
> {1}_${target}_show.action
> 
> Or if it's a 1-to-1 mapping change the naming scheme.
> 
> Still and all, it seems overly-complex.
> 
> d.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-s2--forward-to-another-action--tf4712685.html#a13488289
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] forward to another action?

Posted by Dave Newton <ne...@yahoo.com>.
--- lbastil <ba...@gmx.de> wrote:
> can I use in struts.xml complex ognl statements?

Well... yes, but there's no reason to in this usecase.

> <action name="*_*_*" method="{3}" class="{2}Action">
>   <result name="back" type="redirect-action">
>     {1}_<target>_show.action
>   </result>

Expose a "target" property in your action and do the
lookup there; the destination of your redirect-action
would then be:

{1}_${target}_show.action

Or if it's a 1-to-1 mapping change the naming scheme.

Still and all, it seems overly-complex.

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [s2] forward to another action?

Posted by lbastil <ba...@gmx.de>.
Thank you very much for the response!

I studied docs and noticed the drawbacks.

I could put aside a chaining approach if the following is possible:

can I use in struts.xml complex ognl statements?

<action name="*_*_*" method="{3}" class="{2}Action">
            ...
            <result name="back"
type="redirect-action">{1}_<target>_show.action</result>
            ...

now problem is that depending on {2} I have to calculate <target>

its a simple relationship like:
if "source1" then "target1"
if "source2" then "target2"
... and so on

Is it possible to do that with ognl in struts.xml?

Thank you very much for help,
basti

org.apache.struts2.dispatcher.ServletActionRedirectResult


newton.dave wrote:
> 
> Action chaining is probably the closest you'd get
> out-of-the-box.
> 
> http://struts.apache.org/2.x/docs/chain-result.html
> http://struts.apache.org/2.x/docs/action-chaining.html
> 
> Not a particularly good practice, however.
> 
> d.
> 
> --- lbastil <ba...@gmx.de> wrote:
> 
>> 
>> I know about the possibility to redirect to another
>> action by result type
>> "redirect-action"
>> 
>> But this does a redirect (HTTP 302).
>> 
>> Is the same possible with a "forward" instead of
>> redirect?
>> 
>> Thank you very much in advance,
>> basti
>> -- 
>> View this message in context:
>>
> http://www.nabble.com/-s2--forward-to-another-action--tf4712685.html#a13470792
>> 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
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-s2--forward-to-another-action--tf4712685.html#a13484116
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] forward to another action?

Posted by Dave Newton <ne...@yahoo.com>.
Action chaining is probably the closest you'd get
out-of-the-box.

http://struts.apache.org/2.x/docs/chain-result.html
http://struts.apache.org/2.x/docs/action-chaining.html

Not a particularly good practice, however.

d.

--- lbastil <ba...@gmx.de> wrote:

> 
> I know about the possibility to redirect to another
> action by result type
> "redirect-action"
> 
> But this does a redirect (HTTP 302).
> 
> Is the same possible with a "forward" instead of
> redirect?
> 
> Thank you very much in advance,
> basti
> -- 
> View this message in context:
>
http://www.nabble.com/-s2--forward-to-another-action--tf4712685.html#a13470792
> 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
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org