0

今、新しい 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> 

my:tag で h1 と my:anothertab を実行した結果だけでなく、テキスト全体を取得したい

ありがとう

パスカル

4

0 に答える 0