现在,当我定义一个新的TagLib时,body是某种类型的Closure
class MyTagLib {
static namespace = "my"
def tag = { attrs, body ->
// here I would like to retrieve the actual text of the body not
// its interpretation
def text = body()
}
def anothertag = { atts, body ->
out << body ()
}
}
给出以下gsp:
<my:tag name="example">
<h1>This is an example</h1>
<my:anothertag/>
</my:tag>
我希望我的:标签检索整个文本而不仅仅是执行h1和my:anothertab的结果
由于
帕斯卡