You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Rajan Gupta <rg...@yahoo.com> on 2001/04/11 18:46:29 UTC

Suggestion for Workflow processing in Struts

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="..."
    <On Outcome="Success">
        <forward path="/mainMenu.jsp"/>
    </On>
    <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>        



__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: Suggestion for Workflow processing in Struts

Posted by Rajan Gupta <rg...@yahoo.com>.
The differences are not much between what u are suggesting vs what I
mentioned. 
but I would like to point some differences though:
1. I believe that a Struts action's should have outcomes/results rather
than basing workflows right away. So a manager can say Action has
Result/Outcome (we can choose what we like amongst the 2), rather than
action has workflows, because worklflows can be reused across actions.
2. A workflow should be executed based upon the outcome of an action
   e.g. When a user has made a payment, ActionPayment has the following
        results "Payment Successful", Insufficient Funds"
   Let us say that we want to take the user to an offer Screen to pay his 

   balance if the result is "Insufficient Funds" and also log the fact
that
   we did so. This is my opinion is a workflow which results as an outcome

   of an action.
3. Struts does not use references to JSP pages, actions & possibly using
   the same paradigm may not use references to web flow steps. This will
   lead to code duplicacy in terms of the "type="
   Struts may allow use of references in its actions 
   e.g. Offer.jsp may be referenced using a reference names OfferVU
   allowing OfferVU to be used in any action mapping. So if offer.jsp 
   changes to a new name, we do not have to go to every action mapping and

   replace the name. Similarly for Actions & their types

Thanks
Rajan



--- Ted Husted <hu...@apache.org> wrote:
> 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>


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Re: Suggestion for Workflow processing in Struts

Posted by Ted Husted <hu...@apache.org>.
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>