【发布时间】:2016-06-23 08:44:32
【问题描述】:
class User {
String userName
static constraints = {
userName nullable:false
}
}
*** I tried the different combination of the following in the message.properties ***
User.userName.null.message=The User Name cannot be null/blank
User.userName.null=The User Name cannot be null/blank
[package].User.userName.null.message=The User Name cannot be null/blank
[package].User.userName.null=The User Name cannot be null/blank
但仍然没有运气。我仍然收到默认错误消息,即“类 [package_name] 的属性 [用户名] 不能为空。我使用的是 Grails 3.0.8
【问题讨论】:
-
我也在静态约束中尝试了 userName blank:false ......但结果相同
-
我相信应该是
User.userName.nullable=The User Name cannot be null/blank -
谢谢。它正在工作。应该是 user.userName.nullable=用户名不能为空/空。
-
酷。那么也许你应该为你自己的问题提供一个答案:)
标签: grails grails-orm grails-validation