• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Struts 1.3 DispatchAction

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I inherited a struts 1.3.10 app., and I'm trying to streamline all the classes with DispatchAction.

The current app has a class structure that looks like this:
appplicationClassXYZ (there are a lot of these) --> rootAction --> Action

rootAction is where admin duties are handled (in the execute() method) -- logging, checking that user is logged in, other junk ( filters may be best for some of this). To put all of these classes into one class, I notice from the Struts docs that I need to extend DispatchAction, but I don't override the execute() method or even deal with it in the subclass. So, the question is how can I handle admin duties such that every time superclass is called, the admin stuff, logging, etc. is taken care of? That is, don't I need to extend the execute() method? or do I put the admin stuff in a separate method in rootAction and be sure to call it for every method when I extend the DispatchAction? Seems like I should be able to encapsulate this.

this should be simple, but I'm not getting it. Just not sure how exactly DispatchAction works.

_Rex
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

As you have a rootAction in your current application which is extending a Action class, now you are planning to use a dispatch action now you could write a one class say RootDispatchAction extends DispatchAction ,


Now you can extend each of your action class from application extends to RootDispatchAction.
 
Ranch Hand
Posts: 43
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

do I put the admin stuff in a separate method in rootAction and be sure to call it for every method when I extend the DispatchAction?


but i dont think there no need all those stuff repeated for me alteast.,am not doing like that.
one time is bit enough.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic