Software Development

JSF – Individual Error Message for each field validated


This post demonstrates how to use individual error message for each field validated in JSF. Previously, we used “combined” error messages displayed in only one location on the page in

JSF – Basic Form Validation for Required Fields

For this post, we will reuse most of the stuff in that previous post. Modifying only registration page shown Registration Page - Request section.


Stuff used in this post.

  • JSF 2.2
    • javax.faces-2.2.8.jar
  • JDK 8

Registration Page – Request


Note the for keyword in the <h:message for=".."/> . It refers to the <h:inputText/> ‘s id.


The required fields are Last Name and Email. In order to test with validation error, we’ll submit the page with only First Name provided.


You Might Also Like