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 <[EMAIL PROTECTED]> 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

Reply via email to