|
I was trying a very simple nested tag example (listed below) - NOTE: this is not the age old tag-in-tag example e.g. <g:tag1 name="<g:tag2/>"/>
class MyTagLib { def started = {attrs, body-> out << "started " body() out << " End" } def carryOn = { out << "carry on my wayward sun" } } //main.gsp <g:started><g:carryOn/></g
:started>
what I expected for output was: started carry on my wayward sun End what I got was: started End At first I thought maybe grails didn't support nested tags like this, but then I came across jquery ( http://docs.codehaus.org/pages/viewpage.action?pageId=80300) which (I can't verify) supposedly worked at one time. I investigated that only to find that it, as well, does not work. Anyone have any ideas? Is this a bug? Did the feature set change for taglibs? I was using 0.6 and then thought *maybe* I wasn't using the correct version for it to work... so I upgraded to v1 rc3 to no avail. thx timo |
|
Hey,
instead of just using body() try out << body() I think that should do the trick :-) Cheers Christian
|
|
Thx for the reply, at first I was sure I tried this, then remembered that I had done it with 0.6 and it writes out the Object toString().
I would think it should work without the out << if it's calling a method/closure anyway, thx timo On Jan 14, 2008 8:33 PM, Christian Laakmann <[hidden email]> wrote:
|
|
> I would think it should work without the out << if it's calling a
> method/closure When calling either body() or another tag from within a tag, 'out' is replaced by a string writer, so you always get a string returned from the closure invocation. You then have to write this string to the main response writer. Cheers, Peter --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Stand Trooper
I think this was done to ensure, you are still able to manipulate the body of any tag - for example to encode it in a certain way.
Cheers Christian
|
| Powered by Nabble | Edit this page |
