Struts Validator

xiaoxiao2021-03-06  71

First, write in the struts-config.xml file: xxx.xxxx.xxxx part is the path to the resource file [pre] [/ pre] Here if you want to use multiple ***. XML files, the Value part is written as value = "/ web-inf / validator-rules.xml, / web-inf / validation.xml, / Web-INF / VALIDATION1.XML, /WEB-INF /VALIDATION2.XML "In , it is necessary to add Validate =" true "when defining the action that needs to be verified.

1. Dynamic verification of DynavalidatorForm (Combination Verification)

You don't have to write the corresponding ActionForm, just configure your ActionForm in Struts-Config.xml, set the appropriate items in Form-property, such as MyText, MytexTarea, how often, it will generate an actionform < Form-bean name = "testform" type = "org.apache.struts.validator.dynavalidatorform"> If you need to verify in the Client side, you need to do the following 3 configuration and modifications: a page form was added: οnsubmit = "return validateRegistrationForm (this);" b placeholders inserted JavaScript code that:.