将控制器渲染成字符串
Render a controller into a String
我可以 render a template or a view into a 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'])
我可以 render a template or a view into a 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'])