All Packages  Class Hierarchy  This Package  Previous  Next  Index


Class com.abc.templates.TemplateLoader

java.lang.Object
   |
   +----com.abc.templates.TemplateLoader

public class TemplateLoader
extends Object
TemplateLoader is an object responsible for loading, compiling of templates.Usually this class exist only in one instance per application/servlet.

 o TemplateLoader()
Constructor.
 o compileAll( String sTemplExt, String sComplExt)
sTemplExt - is an extension for original files.
sComplExt is an extension for compiled files.
This method gives us ability to mix plain html file with templates and not to lose benefits of global substituion.
Example: TemplateLoader.compileAll("thtm", "html");
That method will generate html files from thml files and substitute all global tags defined in configurational file.
 o getSubstitute(String)
retrives value for globall substitutor.
 o getSubstitutor()
retrive global Substitutor.
 o getTemplate(String sName)
retrives Template object coresponded to template file sName. Please note: template file must have extension .txt and sName should not have extension.
Example: TemplateLoader.getTemplate("template"); // TemplateLoader.getTemplate("template.txt")
 o setPath(String sPath, String sConfigFile)
sets folder where all templates are located and configurational file in that folde. If you do not need configurational file then pass null.
example: setPath("c:\\", null); Please note '\' symbol at the end of path.
 

 o TemplateLoader

public TemplateLoader()

 o compileAll

 public void compileAll( String sTemplExt,String SComplExt)

 o getSubstitute
public final String getSubstitute(String sName)

 o getSubstitutor
public final Substitutor getSubstitutor()

 o getTemplate
public Template getTemplate(String sName) throws IOException, ClassNotFoundException

 o setPath
public void setPath(String sTemplatePath,
                     String sConfigFile) throws IOException


All Packages  Class Hierarchy  This Package  Previous  Next  Index