Wednesday, November 7, 2012

ValidationMessages.properties not picked up

Hi all,

I'm having trouble internationalizing validation messages using GWT's own Bean Validation support.

My resource files (called ValidationMessages.properties and so on) are in my WEB-INF folder, and contain one resource:

myKey=My resource

Then I have a TestClass to validate:

class TestClass {

@NotNull(message="{myKey}")
String contents;
}

And validation is done as follows:

Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Collection<ConstraintViolation<TestClass>> violations = validator.validate(new TestClass());

I get one constraint violation, as expected, but the violation's getMessage() method returns "{myKey}", not "My resource". Why is that?

I should note that I'm using GWT 2.4 due to dependencies that don't work yet with GWT 2.5. I know validation support is experimental in 2.4, but I'd expect this to work and suspect I'm doing something wrong.

Any ideas?

Thanks,
Ralf

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Mq2RK8mUz7kJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment