com.huihoo.template
Class Template

java.lang.Object
  |
  +--com.huihoo.template.Template

public class Template
extends java.lang.Object

Title: Template Engine Programs Description: my template engine programs for used by Servlet or other template system. Copyright: Copyright (c) 2001 Company: huihoo.com


Field Summary
private  java.lang.String filename
           
private  java.lang.String htmlPage
           
(package private) static java.lang.String path
           
private  java.util.Map templateMap
           
protected  java.lang.String tmplPage
           
 
Constructor Summary
Template(java.lang.String f)
          use the specified filename and the current path
Template(java.lang.String f, java.lang.String p)
          use the specified filename and the specified path
 
Method Summary
private  java.lang.String getFullFilename()
          get the full template file name: path + filename
protected  void loadTemplate(java.lang.String fullname)
          load the template file
 java.lang.String output()
          output template page,at first you must set the tag's value use param
 void param(java.lang.Object key, java.lang.Object value)
          set the template tag's value object
private  void parse()
          generate html page
private  void setFilename(java.lang.String f)
          set the template file name
private  void setPath(java.lang.String p)
          set the tempate file's path
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

private java.lang.String filename

htmlPage

private java.lang.String htmlPage

path

static java.lang.String path

templateMap

private java.util.Map templateMap

tmplPage

protected java.lang.String tmplPage
Constructor Detail

Template

public Template(java.lang.String f)
         throws java.io.FileNotFoundException,
                java.io.IOException
use the specified filename and the current path

Throws:
java.io.FileNotFoundException
java.io.IOException

Template

public Template(java.lang.String f,
                java.lang.String p)
         throws java.io.FileNotFoundException,
                java.io.IOException
use the specified filename and the specified path

Throws:
java.io.FileNotFoundException
java.io.IOException
Method Detail

getFullFilename

private java.lang.String getFullFilename()
get the full template file name: path + filename


loadTemplate

protected void loadTemplate(java.lang.String fullname)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
load the template file

java.io.FileNotFoundException
java.io.IOException

output

public java.lang.String output()
output template page,at first you must set the tag's value use param


param

public void param(java.lang.Object key,
                  java.lang.Object value)
set the template tag's value object


parse

private void parse()
generate html page


setFilename

private void setFilename(java.lang.String f)
set the template file name


setPath

private void setPath(java.lang.String p)
set the tempate file's path