Architecture of Struts 1.x Application
- In the Architecture of struts 1.x application business logic is placed directly in the Action class so it comes under model layer resource.
- Programmer deploys Struts application web server/application server. During this process server performs some initial operation on the deployed struts application.
- End user launches web page or form page of Struts application on browser window.
- End user submits request from form page having form data.
- The controller servlet called ActionServlet traps & takes the request based on its configuration done in web .xml file and also reads form data from form page.
- ActionServlet uses Struts configure file entries to generate integration logic & to decide form bean, Struts Action class to process the request.
- ActionServlet creates / locates form bean class object and writes the received form data to it.
- The form validation logic of form bean class validates the form data.
- ActionServlet creates /locates struts action class object.
- ActionServlet calls execute method of struts Action class.
- This execute method processes the request by using business logic and sends the result & control to ActionServlet.
- ActionServlet uses Action forward configures of struts configure File to decide the result page of Action class.
- ActionServlet passes the result control to result page.
- Presentation logic of result page formats the result the result and sends response to browser window as dynamic webpage.
Note:- form bean class object is visible in the execute method of struts Action class as parameter value.
Struts software created by using multiple technologies so to use these technologies effectively the creators of struts software have implemented some design patterns while creating struts software.
Some important design patterns are:-
1) Singleton design pattern (Action servlet)
2) Front controller (Action Servlet)
3) Abstract controller (Request Dispatcher)
4) IOC (inversion of control) (Action Servlet form bean) Dependency injection
5) V.O.class / D.T.O class (form Bean class)
6) MVC2 (Whole struts APP)