Struts is fully works on MVC architecture MVC means Model View Controller which explain is as follows
- The Model contains the logic and ineract with the persistance storage to retrive and manipulate data.
- The View is responsible for displaying for 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 jobis done by ActionServlet.
The following Events happen when the client browser issues an HTTP request.
- The Action Servlet receive the request.
- struts-config.xml file contains the details regarding Action, ActionForms,ActionMapping and ActionForwards.
- During the startup ActionServlet reads the struts-config.xml file and creates a database of configration object. Later while processing the request the ActionServlet makes a decision by refering to the object.
- Bundles all the request into a javabeans classwhich extends struts ActionForm class.
- Decides which action class to invoketo 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 database and process the request.
- After completing the request processing the action Class returns an ActionForward to the controller.
- Based on the ActionForward the controller will invoke the appropriate view.
- The HTTP response is rendered back to the user by the view component.

No comments:
Post a Comment