Validation framework in Struts
Error/Exception:
ValidatorResources not found in application scope under key "org.apache.commons.validator.VALIDATOR_RESOURCES
FrameWork: Struts1.2/Validation Framework
Jars Files Used:
commons-validator-1.3.1
commons-beanutils-1.8.0
commons-chain-1.2
commons-digester-1.8
commons-logging-1.0.4
All Inside LIB Folder
Configured in struts-config.xml
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="="/开发者_Go百科WEB-INF/validator_rules.xml,/WEB-INF/validation.xml" />
</plug-in>
Question: Where do I get "validator_rules.xml" file?
From the Struts documentation:
By convention, the validators your application uses can be loaded through a file named "validator-rules.xml", and the validator forms (or "validations") can be configured separately (say, in a "validations.xml" file).
You get validator-rules.xml
(not validator_rules.xml
) from the Struts installation. Look inside searching for the proper name (with -
not _
).
The "src" archive is sure to contain it.
精彩评论