Struts 2 Actions Introduction

Struts Action Introduction

In this Section We will discusses the main Actions of the struts action package. The struts actions are one of the core components of Struts2 framework, as they are basically required for any MVC (Model View Controller) framework. In struts these actions plays important role for processing the http request on the server. Each URL is mapped to a specific action, which provides the processing logic necessary to service the request from the user.

But the action also serves in two other important capacities. First, the action plays an important role in the transfer of data from the request through to the view, whether its a JSP or other type of result. Second, the action must assist the framework in determining which result should render the view that will be returned in the response to the request.

Package org.apache.struts.actions

The actions package provides special adapters between the incoming HTTP request and the corresponding business logic.

The description of the default interfaces and classes of the struts action packages are as follows:-

Interface Summary

DownloadAction.StreamInfo:-  The information on a file, or other stream, to be downloaded by the DownloadAction.

Class Summary:-

1. ActionDispatcher:-  Action helper class that dispatches to a public method in an Action.

2. BaseAction:-  BaseAction is provided as an intermediate class for shared funtionality between Action and any stock implementation provided in this package.

3. 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.

4. DownloadAction:- This is an abstract base class that minimizes the amount of special coding that needs to be written to download a file.

5. DownloadAction.FileStreamInfo:- A concrete implementation of the StreamInfo interface which simplifies the downloading of a file from the disk.

6. DownloadAction.ResourceStreamInfo:- A concrete implementation of the StreamInfo interface which simplifies the downloading of a web application resource.

7. EventActionDispatcher:- An Action helper class that dispatches to to one of the public methods that are named in the parameter attribute of the corresponding ActionMapping and matches a submission parameter.

8. EventDispatchAction:- An Action that dispatches to to one of the public methods that are named in the parameter attribute of the corresponding ActionMapping and matches a submission parameter.

9. ForwardAction:- An Action that forwards to the context-relative URI specified by the parameter property of our associated ActionMapping.

10. IncludeAction:-  An Action that includes the context-relative URI specified by the parameter property of our associated ActionMapping.

11. LocaleAction:- Implementation of Action that changes the user's Locale and forwards to a page, based on request level parameters that are set (language, country, & page).

12. LookupDispatchAction:- An abstract Action that dispatches to the subclass mapped execute method.

13. MappingDispatchAction:- An abstract Action that dispatches to a public method that is named by the parameter attribute of the corresponding ActionMapping.

14. SwitchAction:- A standard Action that switches to a new module and then forwards control to a URI (specified in a number of possible ways) within the new module.

The actions package provides special adapters between the incoming HTTP request and the corresponding business logic.