0

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"

tim_yates
  • 167,322
  • 27
  • 342
  • 338
kabira
  • 11
  • 1

1 Answers1

3

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)

Parth Soni
  • 11,158
  • 4
  • 32
  • 54