:Error rendering macro 'code': Invalid value specified for parameter 'lang'
import groovy.text.Template import groovy.text.SimpleTemplateEngine def text = 'Dear \"${firstname} ${lastname}\",\nSo nice to meet you in <% print city %>.\nSee you in ${month},\n${signed}' def binding = ["firstname":"Sam", "lastname":"Pullara", "city":"San Francisco", "month":"December", "signed":"Groovy-Dev"] def engine = new SimpleTemplateEngine() template = engine.createTemplate(text).make(binding) def result = 'Dear "Sam Pullara",\nSo nice to meet you in San Francisco.\nSee you in December,\nGroovy-Dev' assert result == template.toString(). Just get the latest Jetty jar and put this excerpt in a main method, organize the imports and start! Note, that the servlet handler also knows how to serve
*.groovy files and supports dumping:
TODO Provide web.xml
The
.groovyfile and the served by GroovyServlet (and the GroovyScriptEngine), but after generation, the template is evaluated and responded to the client.
Further reading
Article on templating with Groovy templates by Andrew Glover