Two Laptop Bag*
The moose likes Struts and the fly likes Struts Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Question" Watch "Struts Question" New topic
Author

Struts Question

Scott Wertz
Greenhorn

Joined: Sep 29, 2004
Posts: 1
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

Joined: Jul 11, 2001
Posts: 15299
    
    6

Moving to the Web Application Frameworks forum...


GenRocket - Experts at Building Test Data
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Question