Struts Flow Diagram Step By Step

This section involves the steps for executing the struts application.

Ads

Tutorials   
Login form in Struts2 version 2.3.16 Struts 2 Login Application Struts 2 Hello World Annotation Example Struts 2 Tutorial: Easy steps to learn Struts 2 Struts2 Application in Eclipse: Running the application in Eclipse IDE Struts 2 Hello World Application using Eclipse Interceptors in Struts 2 Struts 2 Action Tag Struts 2 in Agile Development Environment Struts 2 UI Tags Generic Tags Creating own Interceptor What are Interceptors in Struts 2 and how do they work? Results Value Stack / OGNL Action in Struts 2 Framework Struts 2 Interceptors Struts 2.3.15.1 Maven - How to use Maven dependency of Struts 2.3.15.1? Download Struts 2.3.15.1 How Struts 2 Framework works? Architecture of Struts 2 Framework Features and Enhancements in Struts 2.3.15.1 Struts 2 Tutorials - Struts version 2.3.15.1 Struts Flow Diagram Step By Step Struts Tutorial Struts 2 Login Form Example Struts 2 Hello World Example Introduction to Struts 2 Framework Downloading and Installing Struts 2.3.8 Struts 2.3.8 released with new features Struts 2.3.8 Tutorials and Examples Subset Tag Actionerror Tag Struts 2 Autocompleter,Struts 2 Autocomplete Generator Tag Struts 2 Application Struts 2 zero configuration,Struts 2 zero configuration Example Static Parameter, Static Parameter in Struts 2, Struts 2 Static Parameter Pagination Example Struts 2.2.1 Title Struts2 ElseIf Tag Example Struts2 Else Tag Example Struts2 If,Else,ElseIf Tag Example Struts2 tag refrences and Example How to download, compile and test the tutorials using ant. Struts 2.1.8 Login Form Struts 2.1.8 Hello World Example Download Struts 2.1.8, Downloading and installing Struts 2.1.8 Showcase application
Ads

Struts Flow Diagram Step By Step

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.

  • ActionContextCleanUp : In the filter chain ActionContextCleanUp is an optional filter which may be excluded when a request goes to the Servlet container. This filter is mainly used for integrating the other technologies.
  • FilterDispatcher : FilterDispatcher is the next filter of the filter chain from which the request is passing and goes to the Servlet container. This filter is the required filter which uses the ActionMapper to specify whether the Action should be invoked or not.

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 :

  • Receive Request : In the first step an struts application receives the request from the resource.
  • Maps Action : The request that the struts application receives is passed through a filter chain. In this filter chain a filter FilterDispatcher specifies the Action according to the received request and mapped to the ActionMapper whether the action should be invoked or not.
  • Interceptor Implementation : Once the Action is mapped to the ActionMapper for invoking the action then the FilterDispatcher will assigned the control to the ActionProxy. The ActionProxy will contact to the struts.xml file and creates the ActionInvocation and the ActionInvocation implements the Interceptors.
  • Execution of Action : The interceptors are invoked for processing the common functionalities. After invoking the interceptors ActionInvocation invokes the Action.
  • Rendering Result : If the Action is invoked according to the request received the ActionInvocation searches for the corresponding result of the Action mapped in struts.xml file. And the result is executed which needs rendering of JSP or templates.
  • Return Response : After executing the result response is returned by the filters configured in the web.xml file. In the process return response the interceptors are invoked in reverse order and provide to perform some additional tasks such as clean-up operation.
  • Display Result : At last the control is returned to the Servlet container which shows the output to the browser according to the received response.

For reading more in detail about Struts 2 you may go through the following link http://www.roseindia.net/struts/struts2/

Advertisements

Share on Google+Share on Google+

Struts Flow Diagram Step By Step

Posted on: July 8, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Struts Flow Diagram Step By Step  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads