Validating user submitted data is very common and a crucial part of any web application. JSF itself provides support for UI component validation and PrimeFaces enhances it with additional features.
In the previous section, we have created a sample user registration form but we did not validate the form for any mandatory fields. Let us enhance the registration form with the validations for mandatory fields.
Assume we have the following validation rules for the registration form:
UserNameshould not be blank.
Passwordshould not be blank and should be at least four characters.
FirstNameshould not be blank.