Hi, I am using DispatchAction to call my own public method in class which extends DispatchAction, but problem is my required method is not called , instead execute() method is called. Where is problem? Here is my code
When using a dispatch action you need to set the parameter property in the action mapping of the struts-config.xml file with some value and when submitting such an action you have to send a request parameter with the parameter name to the one you entered in the config file and the value of this parameter should be the method which you want to call in your action.
Example: In struts config file you will have an entry like this
The logic that forwards to your custom method is in the execute method of DispatchAction. If you override the execute method in your class, you override that logic, thereby disabling the ability to dispatch to another method.
In most cases when extending DispatchAction, you don't want to override the execute method, but merely write your own methods. If you do override execute, you must call super.execute(...) from that method.