JSF2 i18n bean validation messages
How can I return a i18n localized bean validation message?
For example, in:
@Size(min = 1, message = "{pleaseProvideADescription}")
private String description;
Even though I set properties file in faces-config.xml, and I include a pleaseProvideADescription=Please pro开发者_如何学JAVAvide a...
I'm still getting:
{pleaseProvideADescription}
As validation message in tag
Thanks
Bean validation (JSR-303) is completely unrelated to JSF2 (JSR-314). It's another part of standard Java EE API.
The validation messages have to go in a file named ValidationMessages.properties
in the classpath root (which you can internationalize with ValidationMessages_xx_XX.properties
files).
Put your custom message there. You don't need to configure anything in JSF's faces-config.xml
.
精彩评论