我正在尝试使用Play!中的多个参数设置自定义验证错误,但似乎我的验证参数未正确呈现。
我在messages
中定义了:
validation.customerror=This is first param "%s", and this is the second "%s"
我的代码中执行:
validation.addError("","validation.customerror", "FIRST", "SECOND");
我得到了:
This is first param "", and this is the second "FIRST"
而不是
This is first param "FIRST", and this is the second "SECOND"
思想?
答案 0 :(得分:1)
使用如下索引号定义验证消息:
validation.customerror=This is first param "%1$s", and this is the second "%2$s"
请查看Play Framework documentation了解详情。