Tutorials > Program model > Use Struts tags, action forms, and validation

< Previous | Next >


Add the Validator plug-in

In this and the remaining steps of the tutorial, we will enable form validation for the HTML form data in the MyContactUsDisplay.jsp page.

You will begin by making the Store Struts application aware of the Validator framework by adding the latter as a plug-in:


Procedure

  1. The struts-config-ext.xml file should still be open for editing in the Struts Configuration File editor.

  2. Switch to the Plug-ins page of the editor.

  3. In the Plug-ins section, click...

    Add | ValidatorPlugIn | OK

  4. Back on the Plug-ins page, in the Plug-ins section, select the newly-added entry...

    org.apache.struts.validator.ValidatorPlugIn

  5. In the Plug-in Mapping Extensions section, click Add.

  6. In the highlighted entry in the Property column, type pathnames.

  7. In the highlighted entry in the Value column, type...

    /WEB-INF/validator-rules.xml, /WEB-INF/validation.xml

  8. In the Plug-in Mapping Extensions section, click Add.

  9. In the highlighted entry in the Property column, type...

    stopOnFirstError

  10. In the highlighted entry in the Value column, type false.

  11. Save the changes, but leave the editor open.

< Previous | Next >


+

Search Tips   |   Advanced Search