How can I render a GSP as a String?

后端 未结 1 1423
南笙
南笙 2021-01-19 23:53

For my email newsletter I need to render a GSP (the HTML for the newsletter) as a String, so I can pass it to my email method. I’ve found many solutions here o

相关标签:
1条回答
  • 2021-01-20 00:38

    In Grails 2.x, you can inject a groovyPageRenderer into a service. This allows you to render any view or template you want via its render() method.

    For more information, check out this nice post from Mr. Haki.

    Also note that if you’re using the Mail plugin, you can use a view for your email body.

    0 讨论(0)
提交回复
热议问题