Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

How do you map validation results to your view?

Pragya Keshap answered on March 1, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


How do you map validation results to your view?

0

Spring MVC Framework supports JSR-303 specs by default and all we need is to add JSR-303 and it’s implementation dependencies in Spring MVC application. Spring also provides @Validator annotation and BindingResult class through which we can get the errors raised by Validator implementation in the controller request handler method. We can create our custom validator implementations in two ways - the first one is to create an annotation that confirms to the JSR-303 specs and implement its Validator class. Second approach is to implement the org.springframework.validation.Validator interface and add set it as validator in the Controller class using @InitBinder annotation. Let’s create a simple Spring MVC project in Spring Tool Suite where we will use JSR-303 specs with it’s implementation artifact hibernate-validator. We will use annotation based form validation and create our own custom validator based on JSR-303 specs standards. We will also create our own custom validator class by implementing Validator interface and use it in one of the controller handler methods. Our final project looks like below image. 

https://www.digitalocean.com/community/tutorials/spring-validation-example-mvc-validator

Popularity 1/10 Helpfulness 1/10 Language java
Source: Grepper
Link to this answer
Share Copy Link
Contributed on Mar 01 2023
Pragya Keshap
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.