Instead of changing the perform action, how about extending the action
mappings to support workflow constructs? In addition to form bean types,
forwards, redirects, and input pages, the ActionMappings tree could also
store workflows.
if (..) return (mapping.findWorkflow("Failure") ;
else return (mapping.findForward("success"));
<action path="/editSubscription"
type="org.apache...."
name="subscriptionForm"
scope=".."
validate="..."
<forward name="success" path="/mainMenu.jsp"/>
<workflow name="Failure">
<WebflowStep Name="LoginTriesWS"/>
<DisplayView Name="LoginVU"/>
</workflow>
<workflow name="TriesExcedded">
<DisplayView Name="LoginTriesVU"/>
</workflow>
</action>
If the workflow requires additional processing, an extended
ActionServlet could forward control to wherever that processing occurs.
ActionMappings are already used by both the ActionServet and the custom
tags, and so could be used by a workflow processor as well.
Rajan Gupta wrote:
>
> Currently the perform() method in the Action object takes ActionMapping as
> one of the parameters & returns the ActionForward instance corresponding
> to an evaluated result.
>
> Instead, we could let the perform(...) method return a String which is the
> result value. The ActionServlet can then determine what to do based upon
> the outcome of the method. The struts-config.xml file could change like
> this.
> <action path="/editSubscription"
> type="org.apache...."
> name="subscriptionForm"
> scope=".."
> validate="..."
> <forward name="success" path="/mainMenu.jsp"/>
> <On Outcome="Failure">
> <!-- NEW RECOMMENDED WAY OF SPECIFYING STEPS, this will reuse of
> information. Instead of hard coding loginVU.jsp, reference
> another element which describes what is LoginVU
> Similarly for actions
> -->
> <WebflowStep Name="LoginTriesWS"/>
> <DisplayView Name="LoginVU"/>
> </On>
> <On Outcome="TriesExcedded">
> <DisplayView Name="LoginTriesVU"/>
> </On>
> </action>