Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Capturing Grails GSP Output

DZone's Guide to

Capturing Grails GSP Output

· ·
Free Resource
// this creates the template manually and captures the output of the GSP in a StringWriter called "writer"


def binding = [ dude : Dude.get( params.id ) ];  
def writer = new StringWriter();
def template = grailsAttributes.getPagesTemplateEngine().createTemplate("/WEB-INF/grails-app/views/dude/show.gsp", servletContext, request, response);
template.make(binding).writeTo(writer);
println(writer);
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}