Struts2 Architecture Flow Diagram –
Apache Struts 2 is an extensible framework for building enterprise standard Java web applications and plugin support for REST, AJAX and JSON . The struts 2 framework is used to develop MVC-based web application.
STRUTS2 = STRUTS1 + WEBWORK
Struts 2 high level overview of request processing:
Request processing life-cycle in Struts 2 applications:
1) User sends a request to the server for some resource.
2) The FilterDispatcher looks at the request and then determines the appropriate Action.
3) Interceptors configured for applying the common functionalities such as workflow, validation, file upload etc. are automatically applied to the request.
4) Then the action method is executed to perform the database related operations like storing or retrieving data from the database.
5) Then the Result renders the output.
6) Then the request returns through the interceptors in the reverse order. The returning request allows us to perform the clean-up or additional processing.
7) Finally the control is returned to the servlet container, which sends the output to the user browser.
Struts2 Architecture Diagram : –
Action ContextCleanUp filter:
The ActionContextCleanUp filter is optional and it is useful when you want to integrate other technologies like SiteMash Plugin, Tiles Plugin.
After ActionContextCleanUp filter, FilterDispatch is called, takes help of the ActionMapper to determine whether to invoke an Action or not. If the action is required to be invoked, the FilterDispatcher delegates the control to the ActionProxy.
The ActionProxy then takes help from Configuration Files manager, which is initialized from the struts.xml and may be from some other configuration file. Then the ActionProxy creates an ActionInvocation, which process and invokes the Interceptors (if configured) and then invokes the action. The the ActionInvocation looks for proper result. Then the result is executed, which involves the rendering of JSP or templates.
Then the Interceptors are executed again in reverse order. Finally the response returns through the filters configured in web.xml file. If the ActionContextCleanUp filter is configured, the FilterDispatcher does not clean the ThreadLocal ActionContext. If the ActionContextCleanUp filter is not present then the FilterDispatcher will cleanup all the ThreadLocals present.
- Salesforce Certified Platform Developer I – Winter ’18 Release Exam - November 23, 2017
- Salesforce Certified Platform App Builder – Winter ’18 Release Exam - November 22, 2017
- Salesforce Certified Administrator – Winter’ 18 Release Exam - November 21, 2017