Struts 2 Architecture
Struts 2 Framework is very extensible and elegant for the development of enterprise web application of any size. A typical request lifecycle in a Struts 2 application is as summarized below:
- User sends a request to the server requesting for a resource.
- The FilterDispatcher looks at the request and then determines the appropriate Action.
- Interceptors configured in the application pitch in and applies common functionalities like validation, file upload etc. to the incoming request.
- The action method then gets executed which actually does the real business case like storing or retrieving data from database etc.
- The result is then rendered as output.
- The response traverses through the interceptors in the reverse order in which we have a provision to do additional processing as required by your application.
- The control finally comes back to the servlet controller which sends the response to the browser for rendering.
The Struts 2 architecture can be pictorially represented in simple terms as shown in Figure 12-2 below.
Figure 12-2. High-level Struts2 Architecture
Struts 2 is a very elegant, flexible and extensible front controller framework based on many standard technologies like Java Filters, Java Beans, ResourceBundles, XML etc. The Model in Struts 2 framework can use any data access technologies like JDBC, EJB, Hibernate etc. and the View can be integrated with JSP, JTL, JSF, Jakarta Velocity Engine, Templates, PDF, XSLT etc. Figure 12-3 below shows the Struts 2 architecture bringing in the various technologies which can be used in various layers as well as depicts the complete flow of request object.
Figure 12-3. Detailed Struts 2Architecture
Page Visitors: 5769