0
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 

しかし、まだ運がありません。「Property[userName] of clas[package_name] cannot be null. I'm using Grails 3.0.8」というデフォルトのエラー メッセージが引き続き表示されます。

4

1 に答える 1

1

キーはuser.userName.nullableです。リソース バンドルで次のエントリを使用します。

user.userName.nullable=Your custom text
于 2016-03-09T06:36:27.257 に答える