In a tag like below:
<a data-url="/new/request/showText/${requestInstance.id}"> view text</a>
Is there a way to not hardcode the url like I have?
I tried using <g:link action="showText" id="${requestInstance.id}">
but that renders to an anchor tag.
What I'm doing might be find but I'm just curious if there is a better way to do this in grails?
You may use
${createLink(action:'myaction',params:[datasetId:dataset.id])}
for full control. It just returns something like http://myapp/myaction/123
and supportsall the params which g:link
supports.
To be more specific:
<a data-url="${createLink(action:'showText',id: requestInstance.id)}"> view text</a>
should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With