Render a controller into a String

148 views Asked by At

I can render a template or a view into a String, but how can I render a controller into a String ?

I would like to perform this kind of operation:

def myAction = {
  ...
  def html = renderToString(controller: 'myController', action: 'myAction', params: [what:'ever'])
  render modify(html)
  ...
}
1

There are 1 answers

1
MKB On BEST ANSWER

You can use grails include tag for this

def html= g.include(controller: 'myController', action: 'myAction', params: [what:'ever'])