Chapter 18: The Validator Configuration Files

 < Day Day Up > 


The Validator framework is designed to enable you to specify validations declaratively in external configuration files instead of having to hard-code validation logic into the application. This simplifies development because validations can be changed, added, or removed as necessary without having to recompile any code. Using configuration files also enables a significant amount of code reuse for the validation routines.

The Validator configuration files are XML-based and their formats are governed by a Document Type Definition (DTD) file that specifies how the configuration tags must be ordered in each file, what settings are required, and so on. Each Validator configuration file declares its conformance to the DTD by having the following DOCTYPE definition at the top of the file:

<!DOCTYPE form-validation PUBLIC   "-//Apache Software Foundation//DTD Commons    Validator Rules Configuration 1.0//EN"   "">

When Validator reads the configuration file, its XML parser uses the DOCTYPE definition to determine the DTD that the XML file must conform to. If configured to do so, the XML parser will validate the XML file's conformance to the DTD.


An in-depth discussion of using the Validator framework is found in Chapter 6.

 < Day Day Up > 

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

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: