• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Question

 
Scott Wertz
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Web Application Frameworks forum...
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic