You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/03 12:33:13 UTC

DO NOT REPLY [Bug 16697] New: - Newbie FAQ - How can i create a wizard workflow

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16697>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16697

Newbie FAQ - How can i create a wizard workflow

           Summary: Newbie FAQ - How can i create a wizard workflow
           Product: Struts
           Version: Unknown
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Documentation
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: edgar@blue-moose.net


The basic idea is a series of actions with 'next', 'back', �cancel� 
and �finish� actions with a common bean.  Using a LookupDispatchAction is 
reccomended as it fits the design pattern well and can be internationalized 
easily.  Since the bean is shared, each choice made will add data to the 
wizards base of information.  A sample of struts-config.xml follows:

    <form-beans>
        <form-bean  name="MyWizard"
                    type="forms.MyWizard" />
    </form-beans>

    <!�- the first screen of the wizard (next action only available) -->
    <!�- no validation, since the �finish� action is not available -->
    <actions>
        <action path="/mywizard1"
                type="actions.MyWizard" 
                name="MyWizard"
                validate="false"
                input="/WEB-INF/jsp/mywizard1.jsp">
            <forward name="next"
                path="/WEB-INF/jsp/mywizard2.jsp" />
            <forward name="cancel"
                path="/WEB-INF/jsp/mywizardcancel.jsp" />
        </action>

        <!�- the second screen of the wizard (back, next and finish) -->
        <!�- since finish action is available, bean should validated, note 
validation should not necessarily validate if �back� action requested, you 
might delay validation or do conditional validation -->
        <action path="/mywizard2"
                type="actions.MyWizard" 
                name="MyWizard"
                validate="true"
                input="/WEB-INF/jsp/mywizard2.jsp">
            <forward name="back"
                path="/WEB-INF/jsp/mywizard1.jsp" />
            <forward name="next"
                path="/WEB-INF/jsp/mywizard3.jsp" />
            <forward name="finish"
                path="/WEB-INF/jsp/mywizarddone.jsp" />
            <forward name="cancel"
                path="/WEB-INF/jsp/mywizardcancel.jsp" />
        </action>

        <!�- the last screen of the wizard (back, finish and cancel only) -->
        <action path="/mywizard3"
                type="actions.MyWizard" 
                name="MyWizard"
                validate="true"
                input="/WEB-INF/jsp/mywizard3.jsp">
            <forward name="back"
                path="/WEB-INF/jsp/mywizard2.jsp" />
            <forward name="finish"
                path="/WEB-INF/jsp/mywizarddone.jsp" />
            <forward name="cancel"
                path="/WEB-INF/jsp/mywizardcancel.jsp" />
        </action>


The pieces of the wizard are as follows:

    forms.MyWizard.java - the form bean holding the information required

    actions.MyWizard.java - the actions of the wizard, note the use of 
LookupDispatchAction allows for one action class with several methods.  All the 
real work will be done in the 'finish' method.  

    mywizard[x].jsp - the data collection jsp's
    mywizarddone.jsp - the 'success' page
    mywizardcancel.jsp - the 'cancel' page

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org