Grails链接使用GSP外的taglib

我试图使用taglib调用有属性参数,还有taglib使用的标签内部的内容。我找不到要传递给g.link()调用的属性来使其呈现链接的文本。我已经尝试过“身体”和“链接”,“文本”和“链接文本” – 这些都没有。

我期望能够打电话

g.link(action:"foo",controller:"bar",_____:"text of the link here")

但不知道放在_____中

解决方法

通常你这样做:

g.link(action:"foo","text of the link here")

链接文本不需要是最后一个参数,它可能会出现在任何地方:

g.link("text of the link here",action:"foo",controller:"bar")

关闭使用:

而不是字符串,您可以使用返回字符串的闭包:

g.link(action:"foo",{"text of the link here"})

而且,与方法调用的最后一个参数的任何groovy闭包一样,可以将它放在闭括号后面:

g.link(action:"foo",controller:"bar") {"text of the link here"}

相关文章

背景:    8月29日,凌晨4点左右,某服务告警,其中一个...
https://support.smartbear.comeadyapi/docs/soapui/steps/g...
有几个选项可用于执行自定义JMeter脚本并扩展基线JMeter功能...
Scala和Java为静态语言,Groovy为动态语言Scala:函数式编程,...
出处:https://www.jianshu.com/p/ce6f8a1f66f4一、一些内部...
在运行groovy的junit方法时,报了这个错误:java.lang.Excep...