|
|||||
|
|||||
Template Registry
Multiple named templates can be placed in a simple file and loaded into a template registry, for easy use. The code snippet below shows two named templates notice the ::=<< and >>=:: delimiters to identify the start and end of each named template. someTemplateName() ::=<< ...template goes here... >>=:: someOtherTemplateName() ::=<< ...template goes here... >>=:: A Template registry is created and the templated loaded using the registerTemplate method. TemplateRegistry registry = new MVELTemplateRegistry(); registry.registerTemplate( new InputStreamReader( MyClasss.class.getResourceAsStream( "my_templates.mvel" ) ) ); A template from the reigstry can then be parsed using the TemplateInterpreter.parse method. TemplateInterpreter.parse( registry.getTemplate( "someTemplateName"),
null,
vars,
registry )
|
|||||
|
Copyright 2003-2006 - The Codehaus. All rights reserved unless otherwise noted.
Powered by Atlassian Confluence
|
|||||