ee.mare.indrek.jtlt
Class HtmlTemplate

Object
  extended byee.mare.indrek.jtlt.Template
      extended byee.mare.indrek.jtlt.HtmlTemplate

public class HtmlTemplate
extends Template

Html specialized templating class.


Constructor Summary
HtmlTemplate(HtmlTemplateGenerator gen)
          Construct a new html template from given generator.
 
Method Summary
static String encodeHTML(String str)
          Translate special characters <, >, ", ' and & into HTML entities.
static String encodeJs(String str)
          Escape ', \, \n and \r with \ for use inside javascript strings.
static String encodeURL(String str)
          Encode-s URL arguments by replacing unrecognised characters with %XX.
 void instance_rows(String sub_name, ResultSet rset)
          Go through all of the rows in SQL ResultSet (using next()) and for every row lock given sub and replace() all columns inside template.
 void nreplace_raw(String key, String value)
          The same as nreplace but will not HTML escape the value.
 void nreplace(String key, String value)
          Replace given key in the template with value in this block and all subblocks and also in case of plain KEY also apply escapeSpecialChars on it.
 void replace_raw(String key, String value)
          The same as replace but will not HTML escape the value.
 void replace(ResultSet rset)
          Replace a single row from the SQL ResultSet.
 void replace(String key, String value)
          Replace given key in the template with value in the currently active block and in case of plain KEY also apply escapeSpecialChars on it.
 
Methods inherited from class ee.mare.indrek.jtlt.Template
addParam, exists, getBase, instance, instance, lock_back, lock_front, lock, output, replace, toString, unlock
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlTemplate

public HtmlTemplate(HtmlTemplateGenerator gen)
Construct a new html template from given generator.

Method Detail

encodeHTML

public static String encodeHTML(String str)
Translate special characters <, >, ", ' and & into HTML entities.


encodeJs

public static String encodeJs(String str)
Escape ', \, \n and \r with \ for use inside javascript strings.


encodeURL

public static String encodeURL(String str)
Encode-s URL arguments by replacing unrecognised characters with %XX. XX is the hexcode of given character.


instance_rows

public void instance_rows(String sub_name,
                          ResultSet rset)
Go through all of the rows in SQL ResultSet (using next()) and for every row lock given sub and replace() all columns inside template. The column names are converted to lower case. If there is a SQL NULL/null inside resultset it is converted to empty string without complaints.


nreplace_raw

public void nreplace_raw(String key,
                         String value)
The same as nreplace but will not HTML escape the value.


nreplace

public void nreplace(String key,
                     String value)
Replace given key in the template with value in this block and all subblocks and also in case of plain KEY also apply escapeSpecialChars on it.

Overrides:
nreplace in class Template

replace_raw

public void replace_raw(String key,
                        String value)
The same as replace but will not HTML escape the value.


replace

public void replace(ResultSet rset)
Replace a single row from the SQL ResultSet. The resultset pointer must be moved pointing to the row. The resultset is not modified. The column names are converted to lower case.


replace

public void replace(String key,
                    String value)
Replace given key in the template with value in the currently active block and in case of plain KEY also apply escapeSpecialChars on it.

Overrides:
replace in class Template