This has been discussed more times than I can remember, and the outcome of those discussions has always been than there are as many opinions on it as there are stars in the sky.
I myself am with you Faisal... I prefer to have more Actions that each have a discrete bit of functionality rather than a single Action that handles multiple mappings. I don't believe there is any right or wrong answer though, there are valid reasons either way. I've never been a fan of DispatchAction and the like though, so I tend to skew away from them most of the time. But, that aside, to answer your orignial question... yes, there is nothing special about an Action, you can instantiate one and call execute() on it just like any other class. I have done this on many occassions, in very much similar situations to what you have. You can treat it almost, in way (but not really!) like another business delegate. You will either want to ignore the ActionForward it returns, or allow it to override what is done in the caller, whichever is appriproate (usually ignoring it is what's done when calling an Action like this). -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] On Wed, October 5, 2005 7:03 am, [EMAIL PROTECTED] said: > Maybe it is because I am new to struts but I don't see the benefit of > writing one action class to handle a lot of mappings. For > maintainablitity and the way my application is written I have multiple > action classes. > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 05 October 2005 11:57 > To: Struts Users Mailing List > Cc: user@struts.apache.org > Subject: Re: chaining actions i think!! > > Faisal, > > Why are you making different action classes for Search and Edit > functionality. You can have these method in one Action class itself and > then you can call the 'search action mapping' from 'edit action mapping' > > defined in struts-config.xml. If you want more detail that how to do it, > > let me know. > > Sunil > > > > <[EMAIL PROTECTED]> > 05/10/2005 16:17 > Please respond to > "Struts Users Mailing List" <user@struts.apache.org> > > > To > <user@struts.apache.org> > cc > > Subject > chaining actions i think!! > > > > > > > Hi, > > Is there a way that I can call another action from within a action > class. Is it as simple as just calling the execute method of the other > action or another method of the action class as is required.? > > My scenario is as follows: A user searches on a client and is returned a > number of results. He then chooses to edit one of the results and goes > to the edit jsp. After editing the user has the option of returning > back to the search results. > > To show the record that has been edited I am making another trip to the > DB as I don't have a cache. To return back to the results the user > clicks on his button and is forwarded to the edit Action class. It is > from this action class that I want to call the search Action class > passing in the search form which is held in the session. This will then > go to the DB and return to the appropriate search jsp. > > Any one any views on this > > Thanks > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]