Friday, December 11, 2015

Struts actions redirect and action chaining

Action redirect jsp code:
 <package name="default" extends="struts-default">  
   <action name="user" class="com.raj.UserAction">  
     <result name="success" type="redirect">REDIRECT_ACTION</result>  
   </action>  
   <action name="saveAction" class="com.raj.SaveAction">  
     <result name="success">/success.jsp</result>  
   </action>  
 </package>  
In Action redirect it makes a complete a new call to the new action. so the values in to the stack will be of the new actions. while in the case of the action chaining it will make the call to the new action with the values of the previous action and the values of the new actions. Action Chaining jsp code:
 <package name="default" extends="struts-default">  
   <action name="user" class="com.raj.UserAction">  
     <result name="success" type="chain">CHAIN_ACTION</result>  
   </action>  
   <action name="saveAction" class="com.raj.SaveAction">  
     <result name="success">/success.jsp</result>  
   </action>  
 </package>  

No comments:

Post a Comment