wood burning stoves 2.0*
The moose likes Struts and the fly likes Is Multiple Actions in Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Is Multiple Actions in Action class" Watch "Is Multiple Actions in Action class" New topic
Author

Is Multiple Actions in Action class

Rajendra Prakash
Ranch Hand

Joined: Sep 10, 2009
Posts: 293
In ActionClass we can use only one action i.e execute(), but in DispatchAction we can use multiple actions.My question is , we can use multiple actions in Action class if(action.equals("add") ,if(action.equals("update"). Then when to use Action and DispatchAction which is frequently in webapplications.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
Is this some specific framework you're asking about? If so, which one?


Ping & DNS - my free Android networking tools app
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
This is the struts framework. Not sure which one is used more than the other. I have worked on applications that use both. I guess it depends on if you have several action paths, and the functionaluty of each path is similar, then the dispath action may come in handy. Especially if the same form bean is being used for all the different paths/actions.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Moving to Struts.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Doing conditional logic in an execute() method is just one way (a messy one) to implement DispatchActon. I can't think of any particular reason to do the work manually when a mechanism already exists--except if the decision-making process is more difficult than a simple string (for example, which method might depend on a combination of factors).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is Multiple Actions in Action class
 
Similar Threads
Difference between Action And DispatchAction in struts
struts 2 tabbed panel
dispatcher Vs action dispatcher
use dispatchaction in struts
When to use Actionclass in struts