[STRUTS question] Validation, Input, and Wizards

Discussion in 'Java' started by Bernie Wieser, Aug 22, 2003.

  1. We are using the STRUTS validator on a project that allows a user to
    registered themselves through a wizard. That means they step through
    eigh forms (JSP pages) that are backed onto one Action/ActionForm
    class.

    Now, we set the page property on the JSP page, and in the validator,
    but the problem we have is that any error will take use to the
    input page as defined in the struts-config.xml action mappings - which
    is the first page.

    At first I assumed (incorrectly) that if the validator failed, and
    there
    was no input attribute, I would
    be redirected back to the page I was forwarded to. This isn't so, as
    supposedly the input attribute must be present for validation to
    happen.

    So then I thought I could set input="myaction.do"...

    Does anyone have and example of how to use the page attribute from
    validator
    forms with multiple input pages? Or a suggestion of a good scheme to
    have errors directed back to the page they came from (and still use a
    single Action/Form)?

    Cheers,
    Bernie Wieser
     
    Bernie Wieser, Aug 22, 2003
    #1
    1. Advertising

  2. (Bernie Wieser) wrote in message news:<>...
    > [snip]
    > Does anyone have and example of how to use the page attribute from
    > validator
    > forms with multiple input pages? Or a suggestion of a good scheme to
    > have errors directed back to the page they came from (and still use a
    > single Action/Form)?


    So... I checked the FAQ and it suggested setting up multiple
    action paths for wizards sharing a single form. But what the FAQ
    didn't say is that scope for the form needs to be session.
    In addition, validate can't be true, because any previous
    button would validate the current page before returning... so in
    response to the perform/execute, I need to validate explicitly on
    the next button. And then, on any cancel/done button, I need to
    remove the form from session scope after I've done my thing with it.

    Sample from struts-config.xml

    <action path="/public/template/wizard1"
    type="com.myco.template.WizardAction"
    name="wizardForm"
    validate="false"
    parameter="method"
    input="/public/template/wizard1.jsp"
    scope="session">

    <forward name="next" path="/public/template/wizard2.jsp"/>
    </action>

    <action path="/public/template/wizard2"
    type="com.myco.template.WizardAction"
    name="wizardForm"
    validate="false"
    parameter="method"
    input="/public/template/wizard2.jsp"
    scope="session">

    <forward name="prev" path="/public/template/wizard1.jsp"/>
    <forward name="next" path="/public/template/wizard3.jsp"/>
    </action>
     
    Bernie Wieser, Aug 25, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tobin Harris

    Wizards and State Machines

    Tobin Harris, Nov 29, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    434
    Tobin Harris
    Dec 1, 2004
  2. bannaman

    Panles and wizards control

    bannaman, Feb 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    313
    bannaman
    Feb 16, 2006
  3. Code Rodent
    Replies:
    1
    Views:
    8,746
    SpinMap
    Aug 4, 2006
  4. clintonG
    Replies:
    0
    Views:
    332
    clintonG
    Feb 9, 2007
  5. Rain
    Replies:
    0
    Views:
    359
Loading...

Share This Page