hfhc2 hfhc2 - 1 month ago 9
reST (reStructuredText) Question

Grails controller names and URL mappings

I am using grails 3 and I would like to know how the controller names are resolved. Apparently, if the

UrlMappings.groovy
contains

static mappings = {
"/test"(controller: 'test', action: 'index')
}


Then a class
TestController
is needed. However, if I have a controller named
TestValueController
, then the mapping

static mappings = {
"/test"(controller: 'testvalue', action: 'index')
}


does not work. How can I use a controller with a camel case name? More generally, for a controller named XController, which string should be used in the
mappings
section?

Answer

That works fine, except that it's case-sensitive - testvalue should be testValue.

Comments