• 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

Struts Question

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We are currently using DispatchActions extensively. At times we would like to chain functions within different DispatchActions together. The trick is to modify the parameter you are using such as "method" or "dispatch" before you send it to the next DispatchAction. Currenly we modify the parameter in struts config file by tacking it onto the end of the path value. For example the path in the forward mapping would be

path="/QueueList.do?method=filter"

Is there a better way to do this? Should I not be using DispatchActions? You input is appreciated!

Regards,
Scott
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Web Application Frameworks forum...
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without knowing what your DispatchActions do, I would guess that you would be better off creating utility/helper classes to handle the work. That way your core functionality is not piecemealed across the Actions.

Having DispatchActions is not a bad thing but if you find yourself wanting to chain them so they can borrow from each other, you would be better off creating an outside method that multiple actions can use.
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find using DispatchAction a bit restrictive at times, but this is just my opinion. It requires that you do a really detailed analysis and design of your application. However, even if the application is well designed, it needs to be flexible enough to cater to changing requirements. DispatchAction, I feel, does not provide this flexibility.

Advantages of DispatchAction:
- combine many similar actions into a single Action class, in order to simplify application design

Disadvantages of DispatchAction:
- difficulty in action to action forwarding
- mapping characteristics of this Action must be shared by the various handlers (action methods). This means that all actions have to share the same form bean and validation.
- a request parameter is visible to the end user

Using the MappingDispatchAction removes the disadvantages associated with DispatchAction. However, you do end up with an increase in the number of action mappings in the struts-config.xml file. But this is not really an issue since each handler (action method) can now be configured individually.

Sheldon Fernandes
[ September 29, 2004: Message edited by: Sheldon Fernandes ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic