PrimeFaces Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Performing form validations

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:

  • UserName should not be blank.
  • Password should not be blank and should be at least four characters.
  • FirstName should not be blank.