Grails: calling taglib from g: if tag

I have a custom tag library that returns a Boolean object so that my GSP can decide whether to display the html part or not. I would like to use the g: if tag to check this boolean, since I also need to check a few other values ​​(which are not available in taglib). However, I do not know how to actually call taglib from a tag?

I tried:

<g:if test="${<custom:tag/> && other.boolean}">

but it causes errors.

I also tried:

<g:if test="<custom:tag/> && ${other.boolean}">

but it also causes errors.

+3
source share
1 answer

What does taglib look like? Looking at usage, it should be as follows:

class SomeTagLib {
    static namespace = "custom"
    static returnObjectForTags = ['tag']

    def tag = { attrs, body ->
        //returns an object (can be boolean)
    }
}

taglibs StreamCharBuffer. , ( ), , returnObjectFromTags, . , .

, taglib, Tim:

<g:if test="${custom.tag() && other.boolean}"> //should be the appropriate way
+8

All Articles