Magazine
 

Struts2

Struts 2 Architecture

The following diagram depicts the architecture of Struts 2 Framework. Following diagram shows that the initial request goes to the servlet container, which is then passed through standard filer chain.




  The filter chain includes:

1 Action ContextCleanUp filter: The ActionContextCleanUp filter is optional and it is useful when integration has to be done with other technologies like SiteMash Plugin.

2 FilterDispatcher: Next the FilterDispatch is called, which in turn uses the ActionMapper to determine weather to invoke an Action. If the action is required to be invoked, the FilterDispatcher delegates the control to the ActionProxy.

3 ActionProxy: The ActionProxy takes the help from Configuration Files manager, which is initialized from the struts.xml. Then the ActionProxy creates an ActionInvocation, which implements the command pattern. The ActionInvocation process invokes the Interceptors (if configured) and then invokes the action. 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.

Download Struts 2.0 and install Blank application on the Tomcat server

Download the Struts 2.0 at http:// struts.apache.org/download.cgi. Extract the downloaded struts distribution truts-2.0.6- all.zip into your favorite directory.

To install the struts blank application copy “struts2-blank-2.0.6” from “<extracted directory>\struts-2.0.6-all\struts-2.0.6\apps” into the webapps folder of the tomcat directory.
Nov 2007 | Java Jazz Up | 31
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69   Download PDF