我可以render a template or a view into a String,但是如何将 Controller 渲染为String呢?

我想执行这种操作:

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

最佳答案

您可以为此使用grails include tag

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

10-06 01:22