# com.bea.wlw.netui.tags.template
Template Class

public class Template
extends `AbstractBaseTag`
implements `ErrorReporter`, `TemplateConstants`

This tags defines the template to use within a content page. The content page interacts with the template page through children tags of the `Template` tag. The legal children are as follows:

- `setAttribute` -- A Tag that will set an Attribute on the template.
- `section` -- A tag that defines the content of a section defined in the template.

The URL of the template file is set as the `templatePage` attribute on the `Template` tag. The Template file is included from the `Template` tag and will include sections defined in the content page. The content is contained in one or more `Section` tags, which are children of the `Template` tag. In addition, the content page can set attributes of the template page.

Attribute Descriptions
Attribute | Required | Runtime Expression Evaluation | Data Bindable
--- | --- | --- | ---
templatePage | Yes | No | No
The URL of the template JSP. This is a URL that locates the template JSP page.
reportErrors | No | No | No
Does the template contain a <netui:html> tag that should report tag errors?

Related Topics

<netui-template:...> Tags Sample
``Attribute``
``IncludeSection``
``Section``
``SetAttribute``
``Visible``

Hierarchy
  `Object`
  `TagSupport`
  `BodyTagSupport`
  `AbstractBaseTag`
  `Template`

All Implemented Interfaces
  `BodyTag`, `ErrorReporter`, `IterationTag`, `Serializable`, `Tag`, `TemplateConstants`

## Nested Class Summary

`public static class` | `Template.TemplateContext`

## Field Summary

Fields from com.bea.wlw.netui.tags`.`AbstractBaseTag``
``ATTR_GENERAL`, `ATTR_GENERAL_EXPRESSION`, `ATTR_JAVASCRIPT`, `ATTR_STYLE`, `CLASS`, `ID`, `JAVASCRIPT_STATUS`, `NAME`, `NETUI_UNIQUE_CNT`, `ONCLICK`, `ONDBLCLICK`, `ONKEYDOWN`, `ONKEYPRESS`, `ONKEYUP`, `ONMOUSEDOWN`, `ONMOUSEMOVE`, `ONMOUSEOUT`, `ONMOUSEOVER`, `ONMOUSEUP`, `STYLE`, `TABINDEX``

Fields from javax.servlet.jsp.tagext`.`BodyTagSupport``
`bodyContent`

Fields from javax.servlet.jsp.tagext`.`TagSupport``
`id, pageContext`

Fields from interface javax.servlet.jsp.tagext`.`BodyTag``
`EVAL_BODY_BUFFERED, EVAL_BODY_TAG`

Fields from interface com.bea.wlw.netui.tags`.`ErrorReporter``
``CONTAINER_ERRORS``

Fields from interface javax.servlet.jsp.tagext`.`IterationTag``
`EVAL_BODY_AGAIN`

Fields from interface javax.servlet.jsp.tagext`.`Tag``
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

Fields from interface com.bea.wlw.netui.tags.template`.`TemplateConstants``
``TEMPLATE_ATTRIBUTES`, `TEMPLATE_SECTIONS``

## Constructor Summary

Template()

## Method Summary

`public void` | `addError`(`AbstractPageError` ape) Add an error to the errors being reported by this tag.
`public int` | `doEndTag`() The tag extension lifecycle method called after the tag has processed the body.
`public int` | `doStartTag`() the tag extension lifecycle method called when the tag is first encountered.
`public boolean` | `getReportErrors`() Return a boolean indicating that the template expects the template file to report errors
`public `String`` | `getTagName`() Returns the name of the Tag.
`public `String`` | `getTemplatePage`() Return the URL of the template JSP page.
`public boolean` | `isReporting`() This boolean indicates if an ErrorReporter is reporting errors or not.
`protected void` | `localRelease`() Reset all of the fields of the tag.
`public `ArrayList`` | `returnErrors`() Return an ArrayList of the errors
`public void` | `setReportErrors`(boolean reportErrors) Set the boolean indicating that the template should report errors.
`public void` | `setTemplatePage`(`String` templatePage) Set the URL of the template to use.

Methods from `com.bea.wlw.netui.tags.`AbstractBaseTag``
``addTagIdMapping`, `evaluateAttributeToString`, `filter`, `filter`, `getJavaScriptUtils`, `getNearestForm`, `getScriptReporter`, `getUserLocale`, `registerTagError`, `release`, `renderAttribute`, `rewriteName`, `write``

Methods from `javax.servlet.jsp.tagext.`BodyTagSupport``
`doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent`

Methods from `javax.servlet.jsp.tagext.`TagSupport``
`doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue`

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.servlet.jsp.tagext.`BodyTag``
`doInitBody, setBodyContent`

Methods from interface `com.bea.wlw.netui.tags.`ErrorReporter``
``addError`, `isReporting`, `returnErrors``

Methods from interface `javax.servlet.jsp.tagext.`IterationTag``
`doAfterBody`

Methods from interface `javax.servlet.jsp.tagext.`Tag``
`doEndTag, doStartTag, getParent, release, setPageContext, setParent`

## Constructor Detail

### Template

    public Template()

## Method Detail

### addError(AbstractPageError) Method

    public void addError(AbstractPageError ape)

Add an error to the errors being reported by this tag.

#### Parameters

ape
  - The AbstractPageError to add

### doEndTag() Method

    public int doEndTag()
         throws JspException

The tag extension lifecycle method called after the tag has processed the body. This method will include the template JSP page specified by the `templatePage` attribute. The contents of the template are made available to the template page.

Overrides
  `BodyTagSupport.doEndTag()`

#### Returns

SKIP_PAGE to skip all processing after the template.

#### Exceptions

``JspException``
  on all errors. The most common error is an error indicating that the JSP page representing the Template isn't found.

### doStartTag() Method

    public int doStartTag()
         throws JspException

the tag extension lifecycle method called when the tag is first encountered. This will cause the body of the tag to be evaluated.

Overrides
  `BodyTagSupport.doStartTag()`

#### Returns

int indicating that the body should be evaluated.

#### Exceptions

``JspException``
  on errors.

### getReportErrors() Method

    public boolean getReportErrors()

Return a boolean indicating that the template expects the template file to report errors

### getTagName() Method

    public String getTagName()

Returns the name of the Tag. This is used to identify the type of tag reporting errors.

Overrides
  `AbstractBaseTag.getTagName()`

### getTemplatePage() Method

    public String getTemplatePage()

Return the URL of the template JSP page.

#### Returns

a String representing the URL of the JSP template.

### isReporting() Method

    public boolean isReporting()

This boolean indicates if an ErrorReporter is reporting errors or not. The caller should check this before calling addError because the ErrorReporter may be off for some reason.

#### Returns

a boolean indicating if the tag is reporting errors or not.

### localRelease() Method

    protected void localRelease()

Reset all of the fields of the tag.

Overrides
  `AbstractBaseTag.localRelease()`

### returnErrors() Method

    public ArrayList returnErrors()

Return an ArrayList of the errors

#### Returns

an `ArrayList` of all errors.

### setReportErrors(boolean) Method

    public void setReportErrors(boolean reportErrors)

Set the boolean indicating that the template should report errors. The errors will be reported through a HTML tag that must be found in the template JSP.

#### Parameters

reportErrors
  boolean indicating that errors should be reported

### setTemplatePage(String) Method

    public void setTemplatePage(String templatePage)

Set the URL of the template to use. The `templatePage` is an URL which identifies the JSP template page.

#### Parameters

templatePage
  - a URL pointing to a JSP page that represents the template.