File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes LookupDispatchAction vs. traditional Action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "LookupDispatchAction vs. traditional Action" Watch "LookupDispatchAction vs. traditional Action" New topic

LookupDispatchAction vs. traditional Action

Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
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?
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Go for LookupDispatch Action it is only easy for maintenance, if any changes change in one place is enough.
Vicky Pandya
Ranch Hand

Joined: Dec 16, 2004
Posts: 148
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?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: LookupDispatchAction vs. traditional Action
jQuery in Action, 3rd edition