Reputation: 11
How to create the following link in grails using createlink. I have a list of various parameter, at each iteration, it should generate the link as:
http://localhost:8080/search#parameter="123"
Upvotes: 0
Views: 633
Reputation: 578
You should use createlink, look in grails docs here
In your case -
<g:createLink controller="search" action="index"
params="[paramater: '123']"/>
or in you can do like this -
<a href="${g.createLink(controller : 'search', action : 'index',params : [paramater : '123',secondParamater: '5'])}"></a>
Important. This will return params separated with '?' not '#' (Read more about using '#' here)
http://localhost:8080/search?parameter=123&secondParamater=5
But if you really want to use hash parmater(#) -
<a href="${g.creteLink(..)}#paramter=123"> </a>
*(Can't be sure with your controller/action mapping)
Upvotes: 3