0
votes

I am using primefaces4, jsf2.0 and tomcat6 for my application. I am using <p:clientValidator event="blur">. I need to modify the error message for example "Number: Validation Error: Value is required." It is coming on blur if the field is empty but i want to modify that to "Number is required." where "Number" is the label of the field. I have tried this in my resource bundle file "javax.faces.component.UIInput.REQUIRED={0} is Required" but still its showing the old message "javax.faces.component.UIInput.REQUIRED={0} is Required". Plz help me where should i modify the message.

Sorry if any mistakes, am a new bee in jsf. Thanks in advance

1
"my resource bundle file" where exactly is this file located and how exactly did you register it? The symptoms namely indicate that you did that part wrong (i.e. not according the instructions found in the average JSF book/tutorial/answer).BalusC
its located in src folder and i registered that in faces-config as below. <application> <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> <locale-config> <default-locale>en</default-locale> </locale-config> <message-bundle>ApplicationResource</message-bundle> <resource-bundle> <base-name>ApplicationResource</base-name> <var>msg</var> </resource-bundle> </application>esm

1 Answers

0
votes

1) Create your version of validation.properties file (rename it as you want)

2) Add line javax.faces.component.UIInput.REQUIRED={0} is Required in this file.

3) Register your properties file in faces-config.xml:

<application>
    <message-bundle>your.path.here.validation</message-bundle>
</application>

For more info see link Customize validation error message in JSF 2.0