Action in Struts 2 Framework

Actions are the core basic unit of work in Struts 2 framework. Each action provides the processing logic for a specific URL with which it is linked. Actions are mostly associated with a HTTP request of User.

Action in Struts 2 Framework


Actions

Actions are the core basic unit of work in Struts2 framework. Each action provides the processing logic for a specific URL with which it is linked. Actions are mostly associated with a HTTP request of User.

The action class contains business logic, retrieve resource bundle, hold the data, validation, and select the view result page that should send back to the user

action class transfer data from request to the View. It also determines which result should render the view.

class MyAction
{
public void String execute() throws Exception { return "success"; }
}

action class does not extend another class and nor it implements any interfaces.

"execute" method returns a String result code, which actions configuration matches with a specific result that will be rendered to the user.