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
- The struts-config-ext.xml file should still be open for editing in the Struts Configuration File editor.
- Switch to the Plug-ins page of the editor.
- In the Plug-ins section, click Add.
- In the Class Selection dialog, type ValidatorPlugIn. Two plugins are displayed, select the Stores/WebContent/WEB-INF/lib/structs.jar entry and click OK.
- Back on the Plug-ins page, in the Plug-ins section, select the newly-added org.apache.struts.validator.ValidatorPlugIn entry.
- In the Plug-in Mapping Extensions section, click Add.
- In the highlighted entry in the Property column, type pathnames.
- In the highlighted entry in the Value column, type /WEB-INF/validator-rules.xml, /WEB-INF/validation.xml.
- In the Plug-in Mapping Extensions section, click Add.
- In the highlighted entry in the Property column, type stopOnFirstError.
- In the highlighted entry in the Value column, type false.
- Save your changes, but leave the editor open.