简体   繁体   中英

Rename Displayed Field Name in Grails Domain Class

Given the following Grails Domain Classes, how do I go about renaming the displayed field name for isbn to be "ISBN" (as opposed to the default "Isbn") and authors to be "Author(s)" (as opposed to the default "Authors")?

class Book {
    String name
    String isbn
    static hasMany = [ authors: Author ]
}

class Author {
    String name
}

You can just use messages.properties file for that. Go to grails-app --> i18n --> messages.properties

and define message like:

'<full packagePath>.<domain name>.<propertyName>.<attribute>' = <message>

book.isbn.label = ISBN

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM