Pages Navigation Menu

Coding is much easier than you think

Difference between Action Chaining & Action redirect in Struts 2

 
In Struts 2, sometimes you may want to process another action when one action completes. For example on successfully submitting a form you want to render output from other action.
 
This can be done by two methods
 
1) Action Chaining
2) Action redirect
 
Action chaining in Struts 2
 
** UPDATE: Struts 2 Complete tutorial now available here.
 
Difference between Action redirect & Action Chaining:
 
Difference between Action Chaining & Action redirect is, Action Redirect starts from scratch, it is like you called the other action class for the first time while Action Chaining keeps the values of the first Action class on the value stack and adds the variables of the new action. Look at the example below to understand the above concepts.
 
Action Chaining:
 


    
	dbAction
    
    
	/success.jsp
    

 
Action redirect:
 


    
	dbAction
    
    
	/success.jsp
    

 

5 Comments

  1. how about Difference
    between Action Chaining & Redirect Action ?how about Difference between Action Chaining & Redirect Action ?

    (type=”redirectAction” Vs type=”chain”)

  2. Your article extremely nice! Thanks a lot

  3. Hi,

    This article of yours helped me a lot.
    Thank you so much.