Message keys not working

26 views
Skip to first unread message

coderinabstract

unread,
Jul 15, 2012, 5:07:28 PM7/15/12
to gwt-val...@googlegroups.com
message key prints the message as message key

@NotNull(message="{mail.emailId"))
protected String email;

With property in properties file
mail.emailId.message="Email Id cannot be empty"

Constraint Violation message returned is "{mail.emailId}"

Please help on thoughts/work around/fix as this would make this challenging if messages cannot be customized for context and user friendlyness?


coderinabstract

unread,
Jul 15, 2012, 5:30:52 PM7/15/12
to gwt-val...@googlegroups.com
Again being  a newbie should have spent even more time before posting... so the problem was the key should not contain the word message like the constraint customization does.

mail.emailId.message should be mail.emailId in properties file

key mail.emailId is valid and picked up correctly by framework. Sorry for stating this as a problem.

Cheers....

chris.r

unread,
Jul 16, 2012, 4:00:50 PM7/16/12
to gwt-val...@googlegroups.com
I just want to make it clear, as I was going to explain, that the message key in the Constraint and the message key in the file must be the same.

See:


And:


For example: In Oracle's implementation there, of the javax.validation (JSR-303) API, the message key ends in ".message" and matches the JSR-303 standard default ValidationMessages that are provided by gwt-validation.  All that is done in gwt-validation (or Hibernate Validation, or the other frameworks) is a key-lookup on the ValidationMessages.properties file.

Hope that makes it more clear for you and anyone else with the same question.

v/r

Chris  

coderinabstract

unread,
Jul 17, 2012, 12:47:38 AM7/17/12
to gwt-val...@googlegroups.com
Thanks Chris... that helps clarify the message suffix rationale...

Cheers...
Reply all
Reply to author
Forward
0 new messages