22

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.

Dónal
  • 185,044
  • 174
  • 569
  • 824

2 Answers2

30

out << g.datePicker(etc...) ought to do it. The other taglib prefixes are metaprogrammed in automatically.

John Stoneham
  • 2,485
  • 19
  • 10
17

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"}

Maciek
  • 171
  • 1
  • 2