玩! 2.0覆盖“无效值";信息 [英] Play! 2.0 Overwrite "Invalid Value" Message

查看:86
本文介绍了玩! 2.0覆盖“无效值";信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
什么是字段信息和错误?

Possible Duplicate:
What are the i18n message ids for field infos and errors?

使用@Entity类上的@Required之类的注释,可以轻松设置message属性.但是,如何设置/覆盖Double类型的成员在表单上填充字符串时显示的无效值"消息呢?

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?

form.errors() -map包含一个错误,该错误的键值为字段名称",值为"error.invalid",但我无法弄清楚在消息文件中使用的正确键是否会覆盖默认消息.

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.

推荐答案

您必须覆盖

You have to override labels from the source messages file in your own messages.xy files.

还要查看其他答案前一段时间,如果默认语言的文件没有lang扩展名,就会出现问题. AFAIK,该问题已得到解决,但是如果您检查它并确认评论中的当前状态,那将是很酷的.

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.

这篇关于玩! 2.0覆盖“无效值";信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆