JSF Validation Messages

Posted by Jagadeesh VP | Posted in , ,

In JSF, user defined error message can be displayed for validation.

The standard error messages that are shown for each type of validation error are controlled by the Message.properties file.
This file is placed in jsf-impl.jar.

jsf-impl.jar > javax.faces > Message.properties

We can create our own property file and use it in our application.
Eg :

javax.faces.component.UIInput.REQUIRED={0}: Validation Error: Value is required.

javax.faces.component.UIInput.REQUIRED= This field should have value.

Include your file in faces-config.xml.


<application>
<locale-config>
<default-locale> en </default-locale>
</locale-config>
<message-bundle> your.package.MyMessages </message-bundle>
</application>

Comments (0)

Post a Comment