Using Tiles with Modules


Using Validator with Modules

Using Validator with modules works the same way as it does with a non-modularized application. You simply add the Validator plugin to each module's Struts configuration file. Doing so allows each module to specify its own module-specific Validator configuration file, as shown next:

<!-- Validator Configuration --> <plug-in className="org.apache.struts.validator.ValidatorPlugIn">   <set-property property="pathnames"                   value="/org/apache/struts/validator/validator-rules.xml,                          /WEB-INF/validation-moduleA.xml"/> </plug-in>

In this example, the first configuration file specified with the pathnames property is the validator-rules.xml file. Recall from Chapter 6 that this file is used to declaratively plug in the validation routines that Validator will use to perform validations. Because validation routines are typically the same across all modules, you do not need a validator-rules.xml file for each module. Instead, you simply point each module's Validator plugin to the one common file. However, using modules does allow you to specify a unique validation.xml configuration file for each module.

The second configuration file specified with the pathnames property is the module-specific Validator configuration file. This file should include all of the validation definitions specific to the given module.



Struts. The Complete Reference
Struts: The Complete Reference, 2nd Edition
ISBN: 0072263865
EAN: 2147483647
Year: 2004
Pages: 165
Authors: James Holmes

Similar book on Amazon
Struts 2 in Action
Struts 2 in Action
Murach's Java Servlets and JSP, 2nd Edition
Murach's Java Servlets and JSP, 2nd Edition
Jakarta Struts For Dummies
Jakarta Struts For Dummies
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam
Head First Servlets and JSP: Passing the Sun Certified Web Component Developer Exam

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net