Abhilash Shajan
Abhilash Shajan

Reputation: 650

How to Pass params in g:link

I need to pass two params via g:link like below

<g:link controller="ClaimDetails" action="downloadFile1" params="[basePath:${session.basePath}, projCode:${session.projCode}]"><g:message code="claimDetails.ling.notice" /></g:link>

but it gives me an error like

Attribute value quote wasn't closed (controller="ClaimDetails" action="downloadFile1" params="[basePath:${session.basePath}, projCode:${session.projCode}]")

When i give params like basePath:'${session.basePath}'

It gives me the text only.

What i need to do?

Upvotes: 0

Views: 2527

Answers (2)

quindimildev
quindimildev

Reputation: 1280

You don't need to use the ${} inside a g:link tag so:

<g:link controller="ClaimDetails" action="downloadFile1" params="[basePath: session.basePath, projCode: session.projCode]">
    <g:message code="claimDetails.ling.notice" />
</g:link>

Note: why do you use those parameters? cause you have the session object available on your action.

def action(){
    String basePath = session.basePath
    String projCode = session.projCode
}

Upvotes: 2

Mike W
Mike W

Reputation: 3932

Try:

<g:link controller="ClaimDetails" action="downloadFile1" params="${[basePath: session.basePath, projCode: session.projCode]}"><g:message code="claimDetails.ling.notice" /></g:link>

Upvotes: 1

Related Questions