Is there a way to configure Grails 1.1.1 or Grails 1.2 M4 to map a multi-word controller or action written in PascalCase or camelCase to automatically map to a URI with hyphens separating the words?
For example, if I have a controller named MoreInformation with a function named boardOfDirectors, I would like t开发者_如何学编程he URI to resemble:
http://domain.com/more-information/board-of-directors
Is this possible? Thank you.
Assuming you have a method transformURL which converts hyphenated case to CamelCase, something like this should do it.
class UrlMappings {
static mappings = {
"/$initialController/$initialAction?/$id?"{
controller = transformUrl(initialController)
action = transformUrl(initialAction)
}
}
精彩评论