Search code examples
grailsgrails-controller

How do I pass a Grails Arbitrary Variable defined in the URL Mapping to a controller?


I have the following URL Mapping:

"/Manage" {
   controller = "portal"
   action = "login"
   app = "directoryManagement"
}

In the above snippet, app is an arbitrary embedded variable as described here: http://docs.grails.org/2.5.0/guide/single.html#embeddedVariables

The portal controller is a child of the authentication controller. All the login action does in the portal controller is call the login action of the authentication controller.

However, in the authentication controller, I am unable to access the embedded arbritary variable

params.app

I have been at this for hours and it seems like I'm missing something simple. Can anyone advise?


Solution

  • The above code should work for anyone that is trying to pass an arbitrary variable to a controller. I had a typo in my URL mapping which is why I wasn't seeing the 'app' parameter in my authentication controller.