This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
The validate () method doesnt exist in servlet API rather these methods are from 3rd party like in struts where we can use the validate framaework and can the files which you have mentioned .
In validator-rules .xml we define the validation condition of the fields of our form and call then call
validate method to validate form in struts validator_rules.xml in our action class. We need to give path of all these configuration files in our web.xml file.
See some example of struts validator and runt that example and you will be able to understand well.
(Slight expansion: validate() can be used to implement business-oriented logic that can't easily be put into XML configuration. The two XML files differ in that one generally contains the validators themselves, while the other contains the validations. That's an arbitrary distinction, since both files are listed in the Struts configuration.)
Whether you put a given validation in an xml file or into the Java action depends on how complex the validation is. If you have validations that fit with in standard parameters that can be checked using the "bundled" validation types like "required,email,stringlength" then put those in your validation.xml file. If your validations are more complex then you can action's use the validation() method. In fact, you can use both together.
I try to use validate() method and validation.xml both with the same action form with different field, but only validate() method populate but validation.xml rule is not populate. Please anybody could guide me?