0

我知道我可以为 Play 模型层中的 @Required 注释做一个自定义验证消息,如下所示:

@Required(message = "customError.required")
public String name;

但是我尝试对 @MinSize 注释做同样的事情......

@MinSize(8)(message = "customError.passwordSoShort")
public String password;

...并收到此编译错误:

The file /app/models/User.java could not be compiled. Error raised is : Syntax error on token ")", ? expected
@MinSize(8)↓(message = "customError.passwordSoShort")
public String password;
4

1 回答 1

1

您的代码存在语法错误。

尝试:

@MinSize(value=8, message = "customError.passwordSoShort")
public String password;
于 2012-05-10T09:41:35.147 回答