SDK BeanValidation message override

11 views
Skip to first unread message

isern

unread,
Jun 23, 2011, 10:19:11 AM6/23/11
to Google Web Toolkit
Hi!

I managed to setup the native jsr303 validations and they seem to work
fine, however so far I've been unable to replace the default
validation messages.

Hibernate-validator says that a custom ValidationMessages.properties
should be placed in the classpath, but I haven't had any luck.

Any ideas?

Thanks.

Kevin Anderson

unread,
Jun 23, 2011, 10:34:27 AM6/23/11
to google-we...@googlegroups.com
First off, I would go look at the Hibernate Forums for reasons why this is not working. Although RequestFactory does call the validation, the actual implementation is third party. Most of the magic of message replacement happens outside of it.

If you are using Hibernates Validator than the ValidationMessages is the correct properties file you need to have. I would look at the deployment artifact and verify that that properties file is showing up in WEBINF/classes directory somewhere. (I like mine right under classes, less confusing, at least for me.) That should be the only thing you need in order to use Hibernate's validation messages.

Good luck.

isern

unread,
Jun 23, 2011, 2:44:37 PM6/23/11
to Google Web Toolkit
Particularly I was having the problem with the new client-side
validations shipped in GWT 2.4, I didn't make it clear. Maybe there
was some generation issue that is preventing it from working (this is
still beta).

However I could finally solve it by overriding
org.hibernate.validator.ValidationMessages.properties in my project. I
know it's not exactly the most beautiful thing in the world but it
worked for me.

Thanks for your reply, Kevin.
Reply all
Reply to author
Forward
0 new messages