Struts Introduction
- Struts2 is a free Open Source Framework
- Apache Struts2 was originally known as WebWork 2. After working independently for several years, the WebWork and Struts communities joined forces to create Struts2.
- It is based on MVC2 Architecture
- 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 View is implemented by JSP
- Struts 2 is a pull-MVC framework. i.e. the data that is to be displayed to user has to be pulled from the Action. The "pull" comes from the views ability to pull data from an action using Value Stack/OGNL.
- Struts 2 Action class are plain POJO objects thus simplifying the testing of the code.
What is MVC ?
The Model-View-Controller architectural pattern (MVC) divides an
interactive application into three components.
A change-propagation mechanism ensures consistency between the user interface and the model.
Lets take an example to understand MVC mechanism.
In a hotel MVC followed by there employees.
- The model contains the core functionality and data.
- Views display information to the user.
- Controllers handle user input.
A change-propagation mechanism ensures consistency between the user interface and the model.
Lets take an example to understand MVC mechanism.
In a hotel MVC followed by there employees.
- Business Service (Prepare Food)
- View (Add Toping on Food)
- Controller
- Take Order
- Give it to Cook
- Take Food and Give it For Toping
- Finally give it to Customer


