【问题标题】:Create grails <g:link>创建 grails <g:link>
【发布时间】:2015-07-01 16:42:36
【问题描述】:

我在使用&lt;g:link&gt; 标记时遇到问题。

当我使用时

<g:link namespace="print" controller="home" action="terms">Terms &amp; Conditions</g:link>

它会创建以下链接

<a href="/app/print/home/terms">Terms &amp; Conditions</a>

但我想创建一个链接,例如

<a href="/app/print/home/terms#testValue">Terms &amp; Conditions</a>

如何做到这一点?

我尝试使用 "${createLink(controller: 'home', action: 'terms')} 但它不支持命名空间属性。

【问题讨论】:

    标签: grails


    【解决方案1】:

    参考:grails-doc

    您可以使用片段(通常称为锚标记)。

    &lt;g:link namespace="print" controller="home" action="terms" fragment="testValue"&gt;Terms &amp;amp; Conditions&lt;/g:link&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-30
      • 1970-01-01
      • 2018-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-08
      • 1970-01-01
      相关资源
      最近更新 更多