-
Book Overview & Buying
-
Table Of Contents
Spring MVC Beginner's Guide - Second Edition
By :
Java Bean Validation (JSR-303) is a Java specification that allows us to express validation constraints on objects via annotations. It allows the APIs to validate and report violations. Hibernate Validator is the reference implementation of the Bean Validation specification. We are going to use Hibernate Validator for validation.
You can see the available Bean Validation annotations at the following site:
https://docs.oracle.com/javaee/7/tutorial/bean-validation001.htm .
In this section, we will see how to validate a form submission in a Spring MVC application. In our project, we have the Add new product form already. Now let's add some validation to that form:
Open pom.xml, which you will find under the root directory of the actual project.
You will be able to see some tabs at the bottom of the pom.xml file. Select the Dependencies tab and click on the Add button of the Dependencies section.
A Select Dependency window will appear...
Change the font size
Change margin width
Change background colour