This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Is Multiple Actions in Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply 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: 35241
    
    7
Is this some specific framework you're asking about? If so, which one?


Android appsImageJ pluginsJava web charts
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Is Multiple Actions in Action class
 
Similar Threads
struts 2 tabbed panel
use dispatchaction in struts
When to use Actionclass in struts
dispatcher Vs action dispatcher
Difference between Action And DispatchAction in struts