How to send grails <g:link> params as POST

Shiva Mothkuri picture Shiva Mothkuri · Jul 24, 2014 · Viewed 8.8k times · Source

In my application when I use

 <g:link params=[:] />

The params are shown in the URL which I don't want. Is there anyway to send the params without showing in the URL as we do by POST method?

Thank you

Answer

David Santamaria picture David Santamaria · Jul 24, 2014

g:link is a Tag to create a Link, there is no such thing as a Link with POST params, POST and GET (as others) are methods available when you submit data via a form or an ajax request.

Depends on the context you may generate an ajax call or a form for do that.

<g:form controller="myController" action="myAction">
  <g:hiddenField name="myField" value="myValue" />
  <g:submitButton name="Submit" value="Submit" class="lnk" />
</gform>