Reputation: 3
I am using JSF 1.0. I have a text field with required="true"
. How can I override the default validation error message?
Upvotes: 0
Views: 1722
Reputation: 1108632
First create a Messages.properties
file in the com.example
package with the following content:
javax.faces.component.UIInput.REQUIRED = Please fill out this field.
(the key is specific to validator behind required="true"
)
Then declare the message properties file in faces-config.xml
as message-bundle
:
<application>
<message-bundle>com.example.Messages</message-bundle>
</application>
(without file extension!)
For more message keys, check the JSF specification.
Upvotes: 1