Capturing Grails GSP Output
Join the DZone community and get the full member experience.Join For Free
// 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);
Opinions expressed by DZone contributors are their own.