Grails defines a custom error message for a command object

I am writing a Grails application (2.3.3 at present) and have created a valid command object similar to the following:

@Validateable
class MyCustomCommand {
  String name

  static constraints = {
    name blank: false
  }
}

In my i18n/messages.propertiesfile, I defined the following properties to override the default error messages.

MyCustomCommand.name.blank=Name must be provided.
MyCustomCommand.name.null=Name must be provided.

There should be a format for every Grails documentation [Class Name].[Property Name].[Constraint Code], as I already did. When I run my application, if I leave the value empty, I still get the default message for the null property.

I also tried to run the sample default messages and define them as follows, but still get the default message.

MyCustomCommand.name.blank.message=Name must be provided.
MyCustomCommand.name.null.message=Name must be provided.

I assume that here I have missed something simple, but have not yet stumbled upon what. Any suggestions on what I'm doing wrong?

+3
2

. :

myCustomCommand.name.blank=Name must be provided.
myCustomCommand.name.nullable=Name must be provided.


//className.propertyName.blank (camelCase with first letter of class name lower)
+2

, , - . , null, nullable. , .

:

myCustomCommand.name.blank=Name must be provided.
myCustomCommand.name.nullable=Name must be provided.
+1

All Articles