I have a site that have URL similar to this:
/mysite/admin/controller/action/id
/mysite/search/controller/action/id
/mysite/user/controller/action/id
I have my URL mapping like this
"/$prefix/$controller/$action?/$id?"{
constraints {}
}
I am able to get to the controller correctly.
But on the GSP side
<g:link controller="controller">abc</g:link> ==> <a href="/mysite/controller/...">abc</a>
Notice how I lose the prefix between mysite and the controller.
You can use named url mappings and then pass the
prefix
as part of the params:URLMappings:
GSP:
To use
sortableColumn
, just put all of the URLMapping parameters in theparams
property:It works when you hit the URL in browser, because prefix is available in URL. It does not work when you use link tag to create url, because grails does not have information about which prefix should be used for this controller. You will need to provide the value for prefix to link tag.
Try this
in-short - You have to pass those dynamic variables as params if you want link re-writing to consider them. Read more docs here