Dashboard > Struts University > Home > MailReader Training Course > Topics > Register2-Notes
Added by Ted Husted, last edited by Ted Husted on Aug 12, 2006  (view change)

The framework provides an extensive but easy-to-use system for vetting data submitted by a form.

Presentation - Validating Input

Do we need to validate input? Can a validation framework help? Does validation affect workflow? Can we code custom Validators?

The validator framework provides a uniform approach to server-side and client-side validation.

  • Manual Validation
  • Validation Framework
  • Validation Workflow
  • Coding Validators

Workshop - Register extensions

Story: Values submitted by the Register form must be the correct type, and some values are required.

  • Utilize the validation framework to confirm input without changing the server page


  • Field Validator - type, message
    • requiredstring, email, string-length, expression


  • Create a validation configuration file ("Register-validation.xml) to realize the extensions to the Register Use Case
    • Username and Password are required
    • Password length must be at least 4 characters and no more than 10
    • Full Name is required
    • From Address and Reply To Addresses must be email addresses

Hint code

<!DOCTYPE validators PUBLIC "-//OpenSymphony Group//XWork Validator 1.0.2//EN"


  • Utilized the validation framework to validate input without changing the server page

Extra Credit

  • Add an "expression" validator to ensure the password and confirmation password match.
  • In the Register.jsp form tag, add the attribute "validate=true". See any difference? Check the HTML source!
  • Add a cancel button to the form. Try going directly to Welcome, or adding a cancel method that does the same.

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators