wood burning stoves 2.0*
The moose likes Other Application Frameworks and the fly likes Grails custom error messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Grails custom error messages" Watch "Grails custom error messages" New topic
Author

Grails custom error messages

Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
I'm trying to create a custom login error message but clearly I'm missing something. Here's what I have:



The check for uniqueness does work as expected. But I wanted to change from the default message default.not.unique.message in i18n/messages.properties to my own message. I added the following line:



as explained at http://grails.org/Validation+Reference#ValidationReference-nullable.
But it still seems to be using the default message Property [username] of class [class User] with value [mark1] must be unique.

Any ideas?


--Mark
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

The documentation says: Error message code: className.propertyName.unique

Your message entry should look like:
user.username.unique=Username {2} already taken.


A good workman is known by his tools.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
Thanks. It's strange that the default messages don't follow the same format.

--Mark
 
jQuery in Action, 2nd edition
 
subject: Grails custom error messages
 
Similar Threads
@NotNull: how to configure validation message
problems validation.xml in struts 2
struts2: what kicks in first- the interceptors or the form's validation?
problems in validation part of struts 2
Validation in JSF