File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Execute() in DispatchAction" Watch "Execute() in DispatchAction" New topic

Execute() in DispatchAction

Pavan Kumar Tiruvaipati

Joined: Sep 22, 2009
Posts: 1


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

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.

David Newton

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

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.
I agree. Here's the link:
subject: Execute() in DispatchAction
It's not a secret anymore!