tags:

views:

76

answers:

1

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>${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?

A: 

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

leebutts