Struts MVC Architecture:
The model contains the business logic and interact with the persistence storage to store, retrieve and manipulate data.
The view is responsible for display the results back to the user. In Struts the view layer is implemented using JSP.
The controller handles all the request from the user and selects the appropriate view to return. In Struts the controller’s job is done by the ActionServlet.
The following Process happen when the Client browser hits an HTTP request.
- The ActionServlet receives the request.
- The struts-config.xml file control the Actions, ActionForms,ActionMappings and ActionForwards.
- While execute the ActionServelet reads the struts-config.xml file and creates a database of configuration objects. Then processing the request the ActionServlet makes decision by referring to this object.
After ActionServlet receives the request it does the following actions.
- JavaBean class which extends Struts ActionForm class.
- Decides which action class to invoke to process the request.
- Validate the data entered by the user.
- The action class process the request with the help of the model component. The model interacts with the database and process the request.
- Finally the Action class returns an ActionForward to the controller.
- Depends on the ActionForward the controller will invoke the appropriate view
- The Final step is HTTP response is back to the user by the view component