wood burning stoves 2.0*
The moose likes Struts and the fly likes Execute() in DispatchAction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Execute() in DispatchAction" Watch "Execute() in DispatchAction" New topic
Author

Execute() in DispatchAction

Pavan Kumar Tiruvaipati
Greenhorn

Joined: Sep 22, 2009
Posts: 1

Hi,

If I write execute() method in DispatchAction include other methods like add(),delete(),save()......, If I click add button in jsp, which method will invoke first? execute() or add()
Venkat Raman Parasuraman
Greenhorn

Joined: Oct 13, 2008
Posts: 10
the method name you will specify in your parameter property of the action tag. that method will get triggered.


Thanks,
Venkat
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't recall specifically how DispatchAction works, but I'd expect if you implement your own execute() that it wouldn't work at all--DispatchAction has its own execute() method used to function normally.
nish projects
Greenhorn

Joined: May 14, 2012
Posts: 5

Hi, if you define the execute method in the dispatchaction servlet, the execute will be called as from the requestprocessor, action.execute is being called. As the dispatchAction extend the Action class, it will call the execute method. If you see the DispatchAction class, it defines the execute method, in which internally it invokes the appropriate method of the user dispatchaction class. So if you define the execute method, it will not call the execute method of the base DispatchAction class, hence your method will not be called.
 
jQuery in Action, 2nd edition
 
subject: Execute() in DispatchAction
 
Similar Threads
Dispatch Action Issue/Exception
Probably a very simple Struts form question?
Override DispatchAction but keep the existing funcationallity
struts1
Passing parameter to DispatchAction?