Search code examples
javastruts-1

Differences between Action, DispathAction and LookUpDispatchActiom


I would like to know some of differences between Action, DispathAction and LookUpDispatchAction

I would like to know in which scenarios these classes has to be extended.

This is in regards with Struts 1.x


Solution

  • From source code comment:

    Action: An Action is an adapter between the contents of an incoming HTTP request and the corresponding business logic that should be executed to process this request. The controller (RequestProcessor) will select an appropriate Action for each request, create an instance (if necessary), and call the execute method. In most of the cases you would extend this class and override execute() method.

    DispatchAction: An abstract Action that dispatches to a public method that is named by the request parameter whose name is specified by the parameter property of the corresponding ActionMapping. This Action is useful for developers who prefer to combine many similar actions into a single Action class, in order to simplify their application design.

    LookupDispatchAction: An abstract Action that dispatches to the subclass mapped execute method. This is useful in cases where an HTML form has multiple submit buttons with the same name. The button name is specified by the parameter property of the corresponding ActionMapping.