开发者

Grails/Groovy taglib handling parsing dynamically inserted tags

Is there a way to have a custom taglib operate on data loaded in a .gsp file such that it picks up any tags embedded in the data stored in the database. For instance, let's say I'm doing:

      <g:each in="${activities}">
         <li>开发者_StackOverflow社区;${it.payload}</li>
      </g:each>

And inside the payload, which is coming from the database, is text like

"Person a did event <company:event id="15124124">Event Description</company:event>"

Can you have a taglib that handles company:event tags on the fly?


You could write a custom tag which uses the GroovyPagesTemplateEngine to process the text and write it to the output stream. I think you can get an instance of the TemplateEngine injected into your tag from the applicationContext.

I don't have any example code sorry,

cheers

Lee

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜