• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

LookupDispatchAction vs. traditional Action

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Go for LookupDispatch Action it is only easy for maintenance, if any changes change in one place is enough.
 
Vicky Pandya
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic