adspace


Can we change the validator-rules.xml for our own
validations in struts??

Answer Posted / Manish Prasad

In Struts, you can customize validation rules by creating your own Validator classes and adding them to the Validation.xml file. Here's how:

1. Create a new Validator class that extends ActionValidator and implements the required methods (validate(), getValidationErrors()).
2. Define the validation rules for your custom Validator in the Validation.xml file, including the name of your Validator class and any necessary properties.
3. Configure your action classes to use your custom Validator by adding a validate() method that initializes and uses an instance of your Validator class.
4. Test your custom validation by submitting forms with invalid data and verifying that the correct error messages are displayed.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

No New Questions to Answer in this Category !!    You can

Post New Questions

Answer Questions in Different Category