public String buildTemplate(def someBinding){
def template = ApplicationHolder.application.
parentContext.getResource("classpath:template.tmpl")
def engine = new SimpleTemplateEngine()
def template = engine.createTemplate(template.getFile()).make(someBinding)
return template.toString()
}
Obviously an import is needed to run the above code successfully
import org.codehaus.groovy.grails.commons.ApplicationHolder
No comments:
Post a Comment