
Struts Action Chaining?

The struts-config.xml file is used for action mapping. The action tag has a forward entries. Chaining actions can be done by simply using the proper mapping in your forward entries.
public class FirstAction extends Action
{
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
// Developer Logic
return mapping.findForward("success");
}
}
/* com/SecondAction.java */
...
public class SecondAction extends Action
{
public ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws]
Exception
{
// Another Logic
return mapping.findForward("success");
}
}
For chaining action of these two action the code of action in struts-config.xml file.
<action-mappings type="org.apache.struts.action.ActionMapping">
<action path="/First"
type="com.FirstAction"
validate="false">
<forward name="success" path="/Second.do" />
</action>
<action path="/Second"
type="com.SecondAction"
scope="session"
validate="false">
<forward name="success" path="/Output.jsp" />
</action>
</action-mappings>
Thanks.