Thanks for the help. I think I will call the validate() from within the
action.

- GZ


-----Original Message-----
From: Jeff Kyser [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 06, 2003 4:42 PM
To: Struts Users Mailing List
Subject: Re: Multiple "input" within one Action?


I can pass on some help recently provided by others, plus what I did. You
can either have a separate action mapping for each, if you want to have the
validation framework do all the work, or, you can do what I finally ended up
with:

        use all the validation rules, etc.

        but call validate() from your Action

        then, based on your current page and the button you
        pushed (back, next, done), send them to the correct page.

        actually, if they hit a 'back' button (not the browser's back
button)
        you don't want to validate anyway.

Here's a snippet from my config file - /go2wizard has the input= to get the
initial tile loaded, and then everything else is handled by the /wizard
action.
        
         <action path="/go2wizard"
                 parameter="sandbox.wizard.page1"
                 validate="false"
                 name="wizardForm"
                 type="org.apache.struts.actions.ForwardAction">
         </action>

         <action path="/wizard"
                 type="torch.webapp.sandbox.action.WizardAction"
                 name="wizardForm"
                 scope="session"
                 validate="false">
             <forward name="failure"
                      path="/do/go2wizard">
             </forward>
             <forward name="page1"
                      path="sandbox.wizard.page1">
             </forward>
             <forward name="page2"
                      path="sandbox.wizard.page2">
             </forward>
             <forward name="done"
                      path="/do/wizard/success">
             </forward>
         </action>

HTH,

-jeff

On Thursday, March 6, 2003, at 03:05  PM, Zheng, Gang wrote:

> I have a problem with the "input" attribute of the <action>.
>
> I have a dummy action that takes care of the requests posted from a
> number
> of JSPs. It's like a "wizard" type of scenario: input something on the 
> first
> page, then input some other stuff from the second page, etc. All of 
> these
> inputs are directed to the same action, and the action class will 
> decide
> which next page to forward to.
>
> I use validate() within the dummyForm to do validation on the input
> fields.
> Now, if validation fails, I want go back to the same page with an error
> message displayed. I know struts will send me back to the page that is
> defined by "input" attribute once validate() return an error. Since 
> there is
> only one "input" that I can specify for this action, how can I go back 
> to
> "dummy1.jsp" if data from "dummy1.jsp" fails the validation?
>
> Here's the <action> element from struts-config.xml.
>
>         <!-- dummy action -->
>         <action path="/dummy"
>                 type="DummyAction"
>                 name="dummyForm"
>                 scope="session"
>                 input="/jsp/dummy0.jsp">
>           <forward name="dummy0" path="/jsp/dummy0.jsp"
> redirect="true" />
>           <forward name="dummy1" path="/jsp/dummy1.jsp" 
> redirect="true" />
>           <forward name="dummy2" path="/jsp/dummy2.jsp" 
> redirect="true" />
>         </action>
>
> I am sure I can do it if I split the single action into individual
> actions
> to handle each dummy page. But is there anyway that I can do it with 
> the
> single action?
>
> Please point me to the right direction.
>
> Thanks very much for any help.
>
> - GZ


---------------------------------------------------------------------
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