Displaying custom error message for a blank field in a simple JSF application

Posted by 29b5k on Stack Overflow See other posts from Stack Overflow or by 29b5k
Published on 2010-03-25T09:08:47Z Indexed on 2010/03/25 9:13 UTC
Read the original article Hit count: 311

Filed under:
|
|
|

Hi all, I was trying out a simple JSF application, in which I need to check if the "name" field is blank, then display an error message.

The code which takes the field's value is:

<h:outputLabel value="Name"></h:outputLabel> <h:inputText value="#{greeting.name}" required = "true"> <f:validator validatorId="NumValidator"></f:validator> </h:inputText>

The control of the program does not go into the validator class, if the field is submitted without entering anything, and it displays the default error message:

j_id_jsp_869892673_1:j_id_jsp_869892673_4: Validation Error: Value is required.

How do i display a custom message for this ?

© Stack Overflow or respective owner

Related posts about jsf

Related posts about custom