Grails Render Template Different Controller/Path

泪湿孤枕 提交于 2020-01-13 07:44:26

问题


I have a template that exists under views/dashboard/_myTemplate.gsp and from the DashboardController I can simply call

render template:'myTemplate'

and all is well. I have a need to render this template from a different controller but the render method doesn't allow you to specify a controller and I can't seem to figure out how to define the path at which the template exists for the render to work correctly. Is this even possible?


回答1:


You do it by controller name:

render(template:'/dashboard/myTemplate')


来源:https://stackoverflow.com/questions/3160367/grails-render-template-different-controller-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!