You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chandramouli P <ch...@live.com> on 2008/06/27 08:55:40 UTC

Multiple action declarations with the same Action class

Hi,This is my first post to the user list.We have started working in struts recently.Is it possible to use one Action class for multiple action declarations in the struts-config.xml?Consider the code below:<action path="/action1" type="com.sample.app.TestAction" name="formBean1" scope="request">     <forward name="actForward1" path="/test/pages/page1.jsp"/></action><action path="/action2" type="com.sample.app.TestAction" name="formBean2" scope="request">     <forward name="actForward2" path="/test/pages/page2.jsp"/></action><action path="/action3" type="com.sample.app.TestAction" name="formBean3" scope="request">     <forward name="actForward3" path="/test/pages/page3.jsp"/></action><action path="/action4" type="com.sample.app.TestAction" name="formBean4" scope="request">     <forward name="actForward4" path="/test/pages/page4.jsp"/></action>Thanks & Regards,Chandramouli P.
_________________________________________________________________
No Harvard, No Oxford. We are here. Find out !!
http://ss1.richmedia.in/recurl.asp?pid=500

Re: Multiple action declarations with the same Action class

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 6/27/08, Marc Ende <ml...@e-beyond.de> wrote:
> Chandramouli P schrieb:
> > Hi,This is my first post to the user list.We have
> started working in struts recently.Is it possible to use
> one Action class for multiple action declarations in the
> struts-config.xml?Consider the code below:<action
> path="/action1"
> type="com.sample.app.TestAction"
> name="formBean1" scope="request">   
>  <forward name="actForward1"
> path="/test/pages/page1.jsp"/></action><action
> path="/action2"
> type="com.sample.app.TestAction"
> name="formBean2" scope="request">   
>  <forward name="actForward2"
> path="/test/pages/page2.jsp"/></action><action
> path="/action3"
> type="com.sample.app.TestAction"
> name="formBean3" scope="request">   
>  <forward name="actForward3"
> path="/test/pages/page3.jsp"/></action><action
> path="/action4"
> type="com.sample.app.TestAction"
> name="formBean4" scope="request">   
>  <forward name="actForward4"
> path="/test/pages/page4.jsp"/></action>Thanks
> & Regards,Chandramouli P
> 
> Of course you can have multiple action declarations for a
> single Action-Class. You can also specify a seperate method within
> the action for every declared action.

In S1, which appears to be what's being used (for a new project?!) using multiple methods would indicate they'd want to use one of the DispatchAction-like mechanisms.

Dave


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


Re: Multiple action declarations with the same Action class

Posted by Marc Ende <ml...@e-beyond.de>.
Hello

Chandramouli P schrieb:
> Hi,This is my first post to the user list.We have started working in struts recently.Is it possible to use one Action class for multiple action declarations in the struts-config.xml?Consider the code below:<action path="/action1" type="com.sample.app.TestAction" name="formBean1" scope="request">     <forward name="actForward1" path="/test/pages/page1.jsp"/></action><action path="/action2" type="com.sample.app.TestAction" name="formBean2" scope="request">     <forward name="actForward2" path="/test/pages/page2.jsp"/></action><action path="/action3" type="com.sample.app.TestAction" name="formBean3" scope="request">     <forward name="actForward3" path="/test/pages/page3.jsp"/></action><action path="/action4" type="com.sample.app.TestAction" name="formBean4" scope="request">     <forward name="actForward4" path="/test/pages/page4.jsp"/></action>Thanks & Regards,Chandramouli P

Of course you can have multiple action declarations for a single 
Action-Class. You can also specify a seperate method within the action 
for every declared action.

Marc

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