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
  • 33,303
  • 119
  • 337
  • 498
  • `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
  • 3,673
  • 3
  • 46
  • 55
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,833
  • 10
  • 119
  • 200
  • 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