What is advisable and best practice in following situation.
On average, on single HTML form there are 4 buttons. Is it a good practice to extend LookupDispatchAction and have one action class per JSP? Or just extend traditional action class per button click? This way it will have 4 different action classes for single HTML form. However in terms on maintenance and debugging later will be easier?
What's the best practice to extend LookupDispatchAction or simple Action? Merits- Demerits?
Go for LookupDispatch Action it is only easy for maintenance, if any changes change in one place is enough.
Joined: Dec 16, 2004
Maintenance can be looked from two perspectives
1)If DO NOT USE LookupDispatchAction then less code in one action class, which is easy to maintain in compare to having 4 methods in single action class. However this will increase number of files but should be easy to maintain.
2)IF DO USE LookupDispatchAction:- Less number of action classes with more than 1 methods in single class file.
What's the prefer way and best practice? Does anyone know merits and demerits of these two alternatives?
There is no "best practice" in this area. It's a matter of preference and programming style.
One thing that hasn't been mentioned, though, is this: Many of us like to code an abstract base action class for an application that performs tasks common to all actions (checking for login, logging, etc.), and then have all of our Action classes extend this base class. If you use DispatchAction or LookupDispactchAction, it's much more difficult to make these actions extend a base class.