You can use Bean Validation to constrain your data in many different ways. In this recipe, we are going to use it to validate a JSF form so that we can validate it as soon as the user tries to submit it and avoid any invalid data right away.
Using Jakarta Bean Validation for data validation
Getting ready
First, we need to add our dependencies:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
How to do it...
You need...