Using g.render in a grails service

后端 未结 4 392
感动是毒
感动是毒 2020-12-08 21:58

I\'m trying to use g.render in a grails service, but it appears that g is not provided to services by default. Is there a way to get the templating engine to render a view

4条回答
  •  我在风中等你
    2020-12-08 22:35

    My advice would be to do this in the controller. Service should have reusable logic and not depend on a view template, leave that work to the controller. Use the service to get the data you need to pass to the template, but leave the work of interacting with the template to the controller.

提交回复
热议问题