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 provide 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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With