All Packages  Class Hierarchy  This Package  Previous  Next  Index


Class com.abc.templates.Template

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

public class Template
extends Object

Object oriented representation of html page. When TemplateLoader loads template from file template gets reference to template file. So this keeps file is opened. There is two ways to close it. (1) Call destroy method. (2) call writeToHtml method. Because of it you can not output to browser loaded template twice. You need to load it again. And you must call destroy method in case of any exception ( to release file ). It will not hurt if you call destroy after writeToHtml call. Because of it it's good practice to call destroy in finally statement. See examples.


 

 o destroy()
Template object holds reference to template file. You must call this method to close that file. It method has been introduced because Java does not have destructors.
 o getControl(String sName)
returns HtmlControl with name == sName. If control is not exist returns null and developed version of package will output to standard err stream message "Control with name sName does not exist".
 o getControlIfExist(String)
returns Htmlcontrol with with name == sName. If control is not exist returns null. No messages will be outputted.
 o readFromHtml(HttpServletRequest, IValidator)
reads all controls from HttpServletRequest.
 o writeToHtml(HtmlWriter)
Outputs html page to browser. This method will set Content Type to "text/html" automatically.

 o destroy
public final void destroy()

 o getControl
public final HtmlControl getControl(String sName)

 o getControlIfExist
public final HtmlControl getControlIfExist(String sName)

 o readFromHtml
public final boolean readFromHtml(HttpServletRequest req,
                                   IValidator validator) throws Exception

 o writeToHtml
public final void writeToHtml(HtmlWriter out) throws Exception


All Packages  Class Hierarchy  This Package  Previous  Next  Index