GSP CodeHow do I force Grails to use the correct URL in UrlMappings.groovy
given identical paths, with one ending in $action
and the other ending in $id
? On triggering an action through the GSP file, my program goes into the id
URL, causing an error.
You are going to have a tough time here as the $id and $action are just variable names until they are assigned. They don't know that you are sending an id or an action, just that the url matches a pattern. You could do something like this though.
"/workflow/**/$siteId/**/$iteration/**/$action?/$id?" (controller:"*****")
You would have to always specify your action, ***/list/123
or ***/someAction
would match, but not ***/123
.
You could also probably do some sort of constraint / logic in the mapping to sort things out, but that could get sort of messy.