Here is one way I did it using LookDispatchAction I am sure there are other 
ways to do this also:

in my "next" section of the LookupDispatchAction I put:


public class AddPSLUserWizardAction extends LookupDispatchAction {

    public ActionForward next(ActionMapping mapping, ActionForm form,

                        HttpServletRequest request, HttpServletResponse 
response)

                        throws Exception {
                 
                      WizardForm wizardForm = (WizardForm) form;



                    if (...something terrible is happening....)

                        return mapping.findForward("badnext");

                    else 

                        return mapping.findForward("next");

    }

then the badnext will forward to what ever section of the action mappings you 
choose:
 <forward name="badnext" path="/ViewStep1.do" />                        



 <!-- Wizard Mapping -->
         <!-- Step 1 -->
        
         <action path="/ViewStep1"
                name="wizardForm"
                scope="session"
                type="org.apache.struts.actions.ForwardAction"
                input="/step1.jsp"
                parameter="/step1.jsp"
                validate="false" />
     <action path="/ProcessStep1"
        name="wizardForm"
        scope="session"
        type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
        validate="true"
        input="/step1.jsp"
        parameter="methodToCall">
                <forward name="next" path="/ViewStep2.do" />
                <forward name="badnext" path="/ViewStep1.do" />
        </action>

      
        <!-- Step 2 -->
       
        <action path="/ViewStep2"
                name="wizardForm"
                scope="session"
                type="org.apache.struts.actions.ForwardAction"
                validate="false"
                input="/step2.jsp"
                parameter="/step2.jsp" />
        <action path="/ProcessStep2"
                name="wizardForm"
                scope="session"
                input="/step2.jsp"
                type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
                validate="true"
                parameter="methodToCall">
                <forward name="previous" path="/ViewStep1.do" />
                <forward name="next" path="/ViewStep3.do" />
        </action>
      
      
        <!-- Step 3 -->

        <action path="/ViewStep3"
                name="wizardForm"
                scope="session"
                input="/step3.jsp"
                validate="false"
                type="org.apache.struts.actions.ForwardAction"
                parameter="/step3.jsp" />
        <action path="/ProcessStep3"
                name="wizardForm"
                scope="session"
                input="/step3.jsp"
                validate="true"
                type="edu.nmsu.psl.userwizard.AddPSLUserWizardAction"
                parameter="methodToCall">
                <forward name="previous" path="/ViewStep2.do" />
                <forward name="finish" path="/wizard_done.jsp" />
        </action>
      
                                      
  </action-mappings>

I hope this helps.


-----Original Message-----
From: Nicolas De Loof [mailto:[EMAIL PROTECTED]
Sent: Thu 11/3/2005 3:07 AM
To: Struts Users Mailing List
Subject: wizard-style form and validator
 

Hello,

I'm building a wizard style webapp with 3 pages. I'm using the page 
attribute to make validator check inputs.
I've got this problem :
first page validate an userId selection (required)
When this rules failes on page 2 or 3 (let's consider the user has used 
a bookmark), I'd like struts to go back to page 1. How to configure my 
action-mapping for this as I only have one "input" attribute, without 
paging support ?

This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to