In this section we will read about the flow of struts application. Here we will see the architecture of struts with the help of a diagram. We will also describe all the steps involving in executing the application.
In this section we will focus on the Struts 2.X architecture.
Below is the diagram of Struts 2 architecture.
In struts application, struts work flow starts with the request, coming from a resource such as JSP page which is going through the standard filter chain to the Servlet container. The standard filter chain includes ActionContextCleanUp, FilterDispatcher.
If the ActionMapper mapped to Action invocation then the FilterDispatcher assigns control to the ActionProxy. An ActionProxy contacted to the configuration file manager named struts.xml and creates an ActionInvocation which implements the command pattern. Then the configured interceptors are invoked by the ActionInvocation
After invoking the Action the ActionInvocation looks up for the appropriate result related with the Action mapped in struts.xml. Then the result is executed which needs rendering of JSP or templates. After executing the result response is returned through the filters configured in the web.xml. In this process interceptors are executed again and clean up operation of ThreadLocal is performed. In the clean up operation the FilterDispatcher checks for the presence of ActionContextCleanUp filter if, it is not present then it cleans up all the ThreadLocals otherwise, it doesn't clean up ThreadLocal ActionContext.
Steps to invoke Struts 2 applications
Struts 2 Application follows the following steps while executing :
For reading more in detail about Struts 2 you may go through the following link http://www.roseindia.net/struts/struts2/
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial