Adding the Validator plug-in

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

About this task

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.
  4. In the Class Selection dialog, type ValidatorPlugIn. Two plugins are displayed, select the Stores/WebContent/WEB-INF/lib/structs.jar entry and click OK.
  5. Back on the Plug-ins page, in the Plug-ins section, select the newly-added org.apache.struts.validator.ValidatorPlugIn entry.
  6. In the Plug-in Mapping Extensions section, click Add.
  7. In the highlighted entry in the Property column, type pathnames.
  8. In the highlighted entry in the Value column, type /WEB-INF/validator-rules.xml, /WEB-INF/validation.xml.
  9. In the Plug-in Mapping Extensions section, click Add.
  10. In the highlighted entry in the Property column, type stopOnFirstError.
  11. In the highlighted entry in the Value column, type false.
  12. Save your changes, but leave the editor open.