How can I render a GSP as a string?

For my email newsletter, I need to display GSP (HTML for the newsletter) as String , so I can pass it to the email method. Ive found many solutions here on Stack Overflow, but I don’t know which one is best used with Grails 2.2 (the latest version).

So what do you think? How would you visualize GSP as a String without providing an HTTP response?

Thanks and best regards.

Patrick

+4
source share
1 answer

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

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

Also note that if you use the Mail plugin , you can use the look of your email body .

+11
source

All Articles