This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It's best to avoid action chaining until really needed.
A better way to do the above would be to have a Base Action which implements the AccountsList logic. and let it be called whenever you want to list the accounts. This way modify can call AccountsList if it needed it.
It doesn't look like you are using ActionForms... or at least if you are, they are not being controlled by the Struts framework because they are not specified in the ActionMapping. Since that is the case, I do not think you have an acceptable reason to chain Actions.
See, the benefit of Action Chaining to assist prepopulation is usually just a way to get around the fact that the Struts framework only allows one ActionForm in its control per ActionMapping. When navigating between two pages you often need two ActionForms - one for the page you are on and one for the page you are navigating to. And when you need two ActionForms in a single request (unless you create and save the forms to scope yourself, thus bypassing Struts' total control of ActionForms) you need two ActionMappings.
I anticipate that some developers will not share my views. Let the debates begin!
A good workman is known by his tools.
Joined: Jul 17, 2005
I use modifyform bean and Accountlistform bean.. it was just an example of the action mapping given.I have many such situations in my project.Can you please explain the concept of Base Action class and how it can be implemented
Mannu means that you would create an Action class with a bunch of utility methods (which will be a base Action) and all of your current Action classes would then extend the base class instead of Action so they can use these methods internally.
I believe it would actually be better to place these methods in a separate class such as a Business Delegate.