The struts 2 framework is used to develop MVC-based web application.
It is a brand new framework which provides the facility of developing web application based on MVC design pattern. The main features provided by this framework are-
Struts 2 is based on the OpenSymphony Web Works Framework.
Struts 2 framework implements the Model-View-Controller (MVC) design pattern.
In Struts 2 the model, view and controller are implemented by the action, result and FilterDispatcher respectively.
The controller's job is to map the user request to appropriate action.
In Struts 2 FilterDispatcher does the job of Controller.
Model contains the data and the business logic.
In Struts 2 the model is implemented by the Action component.
View is the presentation component of the MVC Pattern.
In Struts 2 the view is commonly implemented using JSP, Velocity Template, Freemaker or some other presentation-layer technology.
It is a design pattern that proposes to divide the functionality of an application in to 3 loosely connected component call model, view and controller. Model represents data or state of an application. View represents presentation or how the data is to be presented to the end user and controller represents the work flow of the application. Work flow represents sequence of steps or manipulation to be performed in order to change an application.
The advantage of using MVC design pattern are-
In struts 2.0 Action represents model components and Action is a POJO class (Plain old java object) that encapsulate data and processing logic in a single unit. Action is responsible for changing the state of an application.
Result- component of struts are represented for generation view. Result is a generic component, multiple implementations of which is provided by framework to support different presentation technologies such as JSP, JSF, velocity template, AJAX, silver light, javaFX.
FilterDispatcher- is the controller implementation provided by the framework. It is a filter which provides a single entry point in to the application and controls the processing of the request.