将链接作为参数传递给grails中的g:render标记

将链接作为参数传递给grails中的g:render标记,grails,gsp,Grails,Gsp,我有一个grails render标记,用于呈现一小块HTML。有时HTMl需要显示一些文本,有时需要显示一些文本和链接 这段代码工作正常: <g:render template='accountInfo' model="[ 'accountStatus':subscription.status, 'subscription':subscription.plan.

我有一个grails render标记,用于呈现一小块HTML。有时HTMl需要显示一些文本,有时需要显示一些文本和链接

这段代码工作正常:

                <g:render template='accountInfo' model="[
                        'accountStatus':subscription.status,
                        'subscription':subscription.plan.name,
                        'msg':g.message (code: 'stripe.plan.info', args:'${[periodStatus, endDate]}')]"/>

但是我希望能够为模型中的'msg'变量传入一些HTML,就像这样输出一些文本和链接:

                <g:render template='accountInfo' model="[
                        'accountStatus':profile.profileState,
                        'subscription':'None selected yet',
                        'msg':<a href="${createLink(controller: 'charge', action: 'basicPlanList')}" title="Start your Subscription">Your profile is currently inactive, select a plan now to publish your profile.</a>]"/>

那个代码不起作用。我已尝试将链接添加到标记库,但我也不知道如何将标记库传递到“msg”:

                <g:render template='accountInfo' model="[
                        'accountStatus':profile.profileState,
                        'subscription':'None selected yet',
                        'msg':<abc:showThatLink/>]"/>


我愿意听取关于如何最好地实现只传递文本、文本和grails createLink闭包以及链接的一些文本的建议。

您有多种选择:

1使用引号:

<g:render template='accountInfo' model='${ [msg: "<a href='www.someurl.com'>.. </a>"]}' />

2.使用另一个变量:

<g:set var="myMsg>
  <a href="www.someurl.com>...</a>
</g:set>`
<g:render template='accountInfo' model='[ 'msg': ${myMsg} ]'/>

#2起作用了,但我必须删除msg的闭包才能让它运行:“msg”:myMsg
<g:render template="accountInfo" model="[ .. ]">
  <a href="..">..</a>
</g:render>