struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harring Figueiredo" <harri...@gmail.com>
Subject Re: Forward a action from one action programmatically in STruts 2.0
Date Fri, 16 Mar 2007 13:54:10 GMT
The way I solve this is by returning the value you want and setting up the
action chain on struts.xml file:

Example:

    class MyAction 1 .. {

    public String execute(){
          if(foo)
              return "foo";
          else
              return "bar";
   }

 Then on the Strutus XML file:

   <action name= "MyAction"  class. = ....>
       <result name="foo" type="chain"> FooAction</result>
       <result name="bar" type="chain"> BarAction</result>
...
 </action>

  PS. Make sure you use type="chain"!
  Hope this helps.

Harring
On 3/15/07, arunkumar S <arunkumar@gmail.com> wrote:
>
> Hi,
>
> I have a requirement where in the action has to be forwarded based on
> certain runtime conditions.The destination will be decided only on the
> runtime.
> -------------------------------
> if(Input = "Case1" )
> forward action1
> else
> forward action2.
> -------------------------------
>
> Basically i want to acheive a simple forward( requestdispatcher.forward()
> ) in
> ActionClass in Struts 2.0.
>
> How can we acheive this in Struts 2.0. I dont have any API to acheive
> this.
>
> Any inputs pls?
>
>
> Regards,
> Arun
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message