Rendering templates in services
Posted by admin - 28/11/09 at 01:11:30 pmIf you want to render gsp template on level of service (or in any other bean), just get org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib bean from spring context, and call method render on it:
class FooService { boolean transactional = false def grailsApplication def bar(view, model) { render(template:"/templates/emails/${view}", model:model) } private def render(args){ grailsApplication.mainContext.getBean('org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib').render(args) } }
November 28, 2009 | In Grails | No Comments
Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds.
Valid XHTML and CSS.