Class HtmlTemplate

java.lang.Object
fr.paris.lutece.util.html.HtmlTemplate

public class HtmlTemplate extends Object
This class represents an HTML template that may include bookmarks that can be substitute by values.
Version:
1.2.5
  • Constructor Details

    • HtmlTemplate

      public HtmlTemplate()
      Constructor 1
    • HtmlTemplate

      public HtmlTemplate(String strTemplate)
      Constructor 2
      Parameters:
      strTemplate - The template as a string
    • HtmlTemplate

      public HtmlTemplate(HtmlTemplate template)
      Constructor 3
      Parameters:
      template - Copy constructor based on another template.
  • Method Details

    • load

      public void load(String strFilename) throws IOException
      Load the template from a file
      Parameters:
      strFilename - The file name to load
      Throws:
      IOException - If an error occured
    • load

      public void load(InputStream is) throws IOException
      Load the template from an InputStream
      Parameters:
      is - The open InputStream that point on the template
      Throws:
      IOException - If an error occured
    • getHtml

      public String getHtml()
      Returns the template.
      Returns:
      The template as a string.
    • substitute

      public void substitute(String strBookmark, String strValue)
      Substitute each appearance of a bookmark by a given value.
      Parameters:
      strBookmark - The bookmark that must be present in the template.
      strValue - The value to substitute as a String.
    • substitute

      public void substitute(String strBookmark, int nValue)
      Substitute each appearance of a bookmark by a given value.
      Parameters:
      strBookmark - The bookmark that must be present in the template.
      nValue - The value to substitute as an integer.
    • substitute

      public void substitute(String strBookmark, Date date)
      Substitute each appearance of a bookmark by a given value.
      Parameters:
      strBookmark - The bookmark that must be present in the template.
      date - The value to substitute as a Date.
    • substitute

      public void substitute(String strBookmark, Timestamp date)
      Substitute each occurence of a bookmark by a given value.
      Parameters:
      strBookmark - The bookmark that must be present in the template.
      date - The value to substitute as a Timestamp.