org.apache.velocity
public class Template extends Resource
Template template = Velocity.getTemplate("test.wm"); Context context = new VelocityContext(); context.put("foo", "bar"); context.put("customer", new Customer()); template.merge(context, writer);
Version: $Id: Template.java,v 1.36.4.1 2004/03/03 22:28:24 geirm Exp $
Field Summary | |
---|---|
Exception | errorCondition |
boolean | initialized
To keep track of whether this template has been
initialized. |
Constructor Summary | |
---|---|
Template() Default constructor |
Method Summary | |
---|---|
void | initDocument()
initializes the document. init() is not longer
dependant upon context, but we need to let the
init() carry the template name down throught for VM
namespace features |
void | merge(Context context, Writer writer)
The AST node structure is merged with the
context to produce the final output.
|
boolean | process()
gets the named resource as a stream, parses and inits
|
Parameters: context Conext with data elements accessed by template writer output writer for rendered template
Throws: ResourceNotFoundException if template not found from any available source. ParseErrorException if template cannot be parsed due to syntax (or other) error. Exception anything else.
Returns: true if successful
Throws: ResourceNotFoundException if template not found from any available source. ParseErrorException if template cannot be parsed due to syntax (or other) error. Exception some other problem, should only be from initialization of the template AST.