jste.template
Class Template

java.lang.Object
  extended by jste.template.Template
Direct Known Subclasses:
CachedTemplate

public class Template
extends java.lang.Object

Expand a template containing embedded Javascript code.


Constructor Summary
Template(java.io.Reader dataReader)
          Create a template from the contents of the given reader.
Template(java.io.Reader dataReader, java.lang.String templateName)
          Create a template from the given reader, using the second parameter as template name.
Template(java.lang.String templateString)
          Create a template from the given string.
Template(java.lang.String templateString, java.lang.String templateName)
          Create a template from the given string, using the second parameter as template name.
 
Method Summary
protected  void _doExpand(java.lang.Object context, DocumentWrapper docWrapper)
           
 void expand(java.lang.Object context, java.io.Writer output)
          Expand this template, writing the results into the output.
protected  DocumentWrapper getOutputWrapper(java.lang.Object context, java.io.Writer output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Template

public Template(java.lang.String templateString)
Create a template from the given string.


Template

public Template(java.io.Reader dataReader)
         throws java.lang.Exception
Create a template from the contents of the given reader.

Throws:
java.lang.Exception

Template

public Template(java.io.Reader dataReader,
                java.lang.String templateName)
         throws java.lang.Exception
Create a template from the given reader, using the second parameter as template name. The template name will be used for error reporting.

Throws:
java.lang.Exception

Template

public Template(java.lang.String templateString,
                java.lang.String templateName)
Create a template from the given string, using the second parameter as template name. The template name will be used for error reporting.

Method Detail

expand

public void expand(java.lang.Object context,
                   java.io.Writer output)
            throws java.lang.Exception
Expand this template, writing the results into the output.

Parameters:
context - the Java object that will be exposed as context in the Javascript code
output - the Writer into which results will be written
Throws:
java.lang.Exception - if syntax or execution errors are encountered

_doExpand

protected void _doExpand(java.lang.Object context,
                         DocumentWrapper docWrapper)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getOutputWrapper

protected DocumentWrapper getOutputWrapper(java.lang.Object context,
                                           java.io.Writer output)
                                    throws java.lang.Exception
Throws:
java.lang.Exception