2

i want to override the default password match error message for primefaces, so here's what i did:

under src/main/resources: i created a properties file called messages.properties and added the following keys/values to it:

primefaces.password.INVALID_MATCH = Passwords doesn't match
primefaces.password.INVALID_MATCH_detail = Passwords doesn't match

and in the faces-config, i added the following:

 <application>

   <locale-config>
  <default-locale>en</default-locale>
   </locale-config>
   <message-bundle>
        resources.messages
   </message-bundle>

but it still prints the default message, please advise.

Mahmoud Saleh
  • 32,503
  • 116
  • 326
  • 490
  • `src/main/resources` suggests that you're using Maven. I don't do Maven, but does this really ultimately end up in the `resources` package in the classpath root (the `/WEB-INF/classes` folder of the WAR), as expected by your `` configuration? If it didn't, then you've there the cause of the problem: it simply can't find the message bundle file. – BalusC Nov 12 '12 at 12:23

2 Answers2

6

Why not just adding validatorMessage ?

<p:password id="password1" required="true"   requiredMessage="Password required"
 match="password2" validatorMessage="Passwords doesnt match">
</p:password>
ihebiheb
  • 2,248
  • 3
  • 37
  • 47
1

Note that primefaces got

Messages.properties and *Messages_en.properties*

Try to rename it into Messages.properties with a capital M (best practice) and try adding Messages_en.properties too (cause the one that inside the primefaces jar might override your new Messages.properties)

<message-bundle>
    resources.Messages
</message-bundle>

(if main being part of the package name try adding it before the resources)

Daniel
  • 36,273
  • 9
  • 115
  • 187
  • Whilst it's indeed a "best practice" problem, uppercase/lowercase should however *not* matter as to the functionality. – BalusC Nov 12 '12 at 12:22