无法覆盖验证错误消息 [英] Cannot override validation error message
问题描述
我想覆盖素数字符的默认密码匹配错误消息,所以这就是我所做的:
i want to override the default password match error message for primefaces, so here's what i did:
在 src/main/resources 下:我创建了一个名为 messages.properties 的属性文件 并向其中添加了以下键/值:
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
在 faces-config 中,我添加了以下内容:
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.
推荐答案
请注意,素面已获得
Messages.properties 和* Messages_en.properties *
Messages.properties and *Messages_en.properties*
尝试使用大写字母M
将其重命名为Messages.properties
(最佳实践),并尝试添加Messages_en.properties
(因为primefaces jar中的那个可能会覆盖您的新消息.属性)
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>
(如果main
是软件包名称的一部分,请尝试将其添加到resources
之前)
(if main
being part of the package name try adding it before the resources
)
这篇关于无法覆盖验证错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!