问题
Possible Duplicate:
What are the i18n message ids for field infos and errors?
Using Annotations like @Required
on a @Entity
-class, a message attribute can be set easily. But how to set / overwrite the "Invalid value" message that is shown when a member of type Double is filled with a string on the form?
The form.errors()
-map contains an error with key "field name" and value "error.invalid", but I can't figure out the correct key to use in the messages file to overwrite the default message.
回答1:
You have to override labels from the source messages file in your own messages.xy
files.
Also take a look at the other answer some time ago there was a problem if file for default language hasn't the lang extension. AFAIK it was fixed after that answer, however it would be cool if you'll check it and confirm the current state in the comment.
来源:https://stackoverflow.com/questions/12773009/play-2-0-overwrite-invalid-value-message