From user-return-166974-apmail-struts-user-archive=struts.apache.org@struts.apache.org Sat Mar 17 02:24:19 2007 Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 78102 invoked from network); 17 Mar 2007 02:24:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Mar 2007 02:24:18 -0000 Received: (qmail 65485 invoked by uid 500); 17 Mar 2007 02:24:16 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 65475 invoked by uid 500); 17 Mar 2007 02:24:16 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 96656 invoked by uid 99); 16 Mar 2007 19:58:09 -0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of arunkumar@gmail.com designates 66.249.92.170 as permitted sender) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=KlFTNtlwyq0SNlxMHEHbLjje8bY8ZnNZrY/itaiYLhXflDEbleWF1Zhj8Xs1+Yzu1e5o0vEM7jinHMKc1TpSckxqW/QSZhSvetB6x7DTY7K4pq8TeYQBpY3SCqIH4eBKTvgmHjyTrV4nWdC96LW0nD6EOXGz0Oz/1qCA51Mz+F8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=IMnt130F6a4stUxWrzIIrdFHu3v4fD+RSGR0lO8r9VvDwt5jqkVSJwBaxFPGBkIZguvbRkwj4ZtD/NO9eFon3M0E55IZbCzRCGwzch15LoUKwMu/MAq2anAUvQluCCNW5Ct2M/nK7fN5x+OPRAEAYwUAiqlJucf9ftHepg7ya1c= Message-ID: <890fccdb0703161257l4e0f72dcyc51be6b0ab4210e2@mail.gmail.com> Date: Fri, 16 Mar 2007 14:57:35 -0500 From: "arunkumar S" To: user@struts.apache.org Subject: Re: Forward a action from one action programmatically in STruts 2.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_118082_16454644.1174075055618" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_118082_16454644.1174075055618 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Thanks for the inputs. my req. will not satisfy your suggestion. My req. is I have to load different Jsps depending on the user profile. eg . for user with profile = "abc", i will have JSps like 1_abc.jsp,2_abc.jsp,3_abc.jsp for user with profile = def , i will have jsps like 1_def.jsp,2_def.jsp etc.. one way of solving this is to mention all the Jsp for users with different profile in the results and then forward it in the action itself. like 1_abc.jsp 1_def.jsp 2_abc.jsp 2_def.jsp return corresponding result in each action based on the users profile. but the pblm here for each action the application developer has to define results for each user. I am thinking of moving this to framework. Below is the new approach. 1.jsp 2.jsp /{1}.jsp Now , in an action1.class & action2.class depending on the user profile i construt 1_abc.action or 1_def.action and 2_abc.action or 2_def.action respectively . and if i can forward with 1_abc.action the below definition present in the STruts.xml will take care of forwarding it to 1_abc.jsp /1_def.jsp depending on the user automatically. /{1}.jsp FOr this i need to programmatically forward to an action so that i can leverage the above mentioned facility. I hope i have made things clear.Let me know if have any suggestions. Regards, Arun. 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: FooAction BarAction ... 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 ------=_Part_118082_16454644.1174075055618--