Package fr.paris.lutece.util.html
Class HtmlTemplate
- java.lang.Object
-
- fr.paris.lutece.util.html.HtmlTemplate
-
public class HtmlTemplate extends java.lang.ObjectThis class represents an HTML template that may include bookmarks that can be substitute by values.- Version:
- 1.2.5
-
-
Constructor Summary
Constructors Constructor Description HtmlTemplate()Constructor 1HtmlTemplate(HtmlTemplate template)Constructor 3HtmlTemplate(java.lang.String strTemplate)Constructor 2
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetHtml()Returns the template.voidload(java.io.InputStream is)Load the template from an InputStreamvoidload(java.lang.String strFilename)Load the template from a filevoidsubstitute(java.lang.String strBookmark, int nValue)Substitute each appearance of a bookmark by a given value.voidsubstitute(java.lang.String strBookmark, java.lang.String strValue)Substitute each appearance of a bookmark by a given value.voidsubstitute(java.lang.String strBookmark, java.sql.Date date)Substitute each appearance of a bookmark by a given value.voidsubstitute(java.lang.String strBookmark, java.sql.Timestamp date)Substitute each occurence of a bookmark by a given value.
-
-
-
Constructor Detail
-
HtmlTemplate
public HtmlTemplate()
Constructor 1
-
HtmlTemplate
public HtmlTemplate(java.lang.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 Detail
-
load
public void load(java.lang.String strFilename) throws java.io.IOExceptionLoad the template from a file- Parameters:
strFilename- The file name to load- Throws:
java.io.IOException- If an error occured
-
load
public void load(java.io.InputStream is) throws java.io.IOExceptionLoad the template from an InputStream- Parameters:
is- The open InputStream that point on the template- Throws:
java.io.IOException- If an error occured
-
getHtml
public java.lang.String getHtml()
Returns the template.- Returns:
- The template as a string.
-
substitute
public void substitute(java.lang.String strBookmark, java.lang.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(java.lang.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(java.lang.String strBookmark, java.sql.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(java.lang.String strBookmark, java.sql.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.
-
-