wood burning stoves 2.0*
The moose likes Struts and the fly likes how to create one validator in a wizard? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to create one validator in a wizard?" Watch "how to create one validator in a wizard?" New topic

how to create one validator in a wizard?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi all,

I have a wizard (4 pages) composed with one form and one action (dispatchAction).I would like to show the end-user the errors on the screen before the user can move to the next page.

Is it possible to achieve this with one form? if I place all restrictions in validate, it will not allow me to move to the next page (since there are fields which were not addressed in the *next* page).

*if not, what other design is recommended?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
You can do this by:
  • Having your ActionForm extend ValidatorActionForm instead of ValidatorForm
  • In the validation.xml file, instead of specifying the ActionForm name in as the name attribute of the <form> tag, specify the action path instead
  • Create separate <form> stanzas for each action, each one specifying the fields to be validated for that action.

  • For more information, read the first paragraph of the Struts Validator Guide
    [ February 17, 2007: Message edited by: Merrill Higginson ]

    Consultant, Sima Solutions
    I agree. Here's the link: http://aspose.com/file-tools
    subject: how to create one validator in a wizard?
    Similar Threads
    generating an emf model from annotated java but no package selection
    problem with registration page
    Pass Object to Page
    skip validation
    How to Pass value from one one wizard page to the other in JFACE