Search code examples
grailsurl-mapping

Map two levels and a variable to a controller


I want to add the following to UrlMappings.groovy:

"/level1/level2/$paramVariable"(controller:"doSomething", action: "index")

For some reason, this mapping does not actually map the URL to the DoSomethingController. Is there a workaround other than turning level2 into a variable?


Solution

  • I was creating the link with createLink(controller: "doSomething", action: "paramVariableValue") when it should have been createLink(controller: "doSomething", params:[paramVariable:"paramVariableValue"].