В Grails я не могу переопределить сообщение об ошибке по умолчанию

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 

Но все равно не повезло. Я все еще получаю сообщение об ошибке по умолчанию: «Свойство [userName] clas [package_name] не может быть нулевым. Я использую Grails 3.0.8.


person ronald    schedule 09.03.2016    source источник
comment
Я также пробовал пустое имя пользователя: false в статических ограничениях... но тот же результат   -  person ronald    schedule 09.03.2016
comment
Я считаю, что это должно быть User.userName.nullable=The User Name cannot be null/blank   -  person Emmanuel Rosa    schedule 09.03.2016
comment
Спасибо. Это работает. Должно быть user.userName.nullable=Имя пользователя не может быть нулевым/пустым.   -  person ronald    schedule 09.03.2016
comment
Прохладный. Тогда, возможно, вы должны дать ответ на свой вопрос :)   -  person Emmanuel Rosa    schedule 09.03.2016


Ответы (1)


Ключ user.userName.nullable. Используйте следующую запись в своем пакете ресурсов.

user.userName.nullable=Your custom text
person saw303    schedule 09.03.2016