Grails: Invoking one taglib from within another
Question
I want to define my own taglib that will use the g:datePicker
to generate some of it's output.
class MyTagLib
def myTag = {attrs ->
// I need to invoke the `datePicker` tag of the the `FormTagLib` tag library
// provided by Grails
}
}
I want to pass along the attributes map when I invoke this tag. When I invoke g:datePicker
I would like it to write it's output directly to the response (just as it does when you invoke it within a GSP).
How can I do this? Thanks.
Solution
out << g.datePicker(etc...)
ought to do it. The other taglib prefixes are metaprogrammed in automatically.
OTHER TIPS
If you want to add a body, you need to pass a closure:
out<<g.link(action: x, {"This is a link to x"})
or out<<g.link(action: x) {"This is a link to x"}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow