Spring MVC Custom Validation
The Spring MVC framework allows us to perform custom validations. In such case, we declare own annotations. We can perform validation on the basis of own business logic.
Spring MVC Custom Validation Example
In this example, we use both pre-defined annotations as well as custom annotations to validate user input.
1. Add dependencies to pom.xml file.
2. Create the bean class
3. Create the controller class
4. Create the validator annotation
5. Create the validator class
6. Provide the entry of controller in the web.xml file
7. Define the bean in the xml file
8. Create the requested page
9. Create the other view components
Here, we entered the password without having "jtp" sequence.
Now, we entered the password having "jtp" sequence.