我试图使用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"}