我想为约束验证器提供不同的消息,但我正在徘徊如何做....
例子
@Constraints.Required
@Constraints.Pattern("\\d{1,6}")
public String thisIsAnInt;
我想要一些东西
@Constraints.Required
@Constraints.Pattern(message="ThisismyspecificMessage",value=\\d{1,6}")
public String thisIsAnInt;
用于在表单中使用 bootstrap 正确显示它。
有可能的?
多谢
最佳答案
正如你所写,你可以使用
@Constraints.Required(message = "This is field required")
@Constraints.Pattern(value = "\\d{1,6}", message = "This field must contain from 1 to 6 digits")
public String thisIsAnInt;
关于playframework-2.0 - play20 验证器中的约束消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9826817/