org.apache.beehive.netui.tags.template
Class Template
Object
TagSupport
BodyTagSupport
AbstractClassicTag
Template
- All Implemented Interfaces:
- Serializable, BodyTag, IterationTag, JspTag, Tag, IErrorReporter, INetuiTag, TemplateConstants
public class Template
- extends AbstractClassicTag
- implements TemplateConstants, IErrorReporter
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.
- See Also:
- Serialized Form
- Example
- The following example shows a content page that adopts the template.jsp page as its template.
The content page also sets the "title" attribute on the template.
<netui-template:template templatePage="./template.jsp">
...
<netui-template:setAttribute name="title" value="Template Tags Sample"/>
...
</netui-template:template>
Fields inherited from class BodyTagSupport |
bodyContent |
Fields inherited from class TagSupport |
id, pageContext |
Fields inherited from interface BodyTag |
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface IterationTag |
EVAL_BODY_AGAIN |
Fields inherited from interface Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Method Summary |
void |
addError(AbstractPageError ape)
Add an error to the errors being reported by this tag. |
int |
doEndTag()
The tag extension lifecycle method called after the tag has
processed the body. |
int |
doStartTag()
the tag extension lifecycle method called when the tag is first
encountered. |
String |
getTagName()
Returns the name of the Tag. |
boolean |
isReporting()
This boolean indicates if an ErrorReporter is reporting errors
or not. |
protected void |
localRelease()
Reset all of the fields of the tag. |
ArrayList |
returnErrors()
Return an ArrayList of the errors |
void |
setDocumentType(String docType)
|
void |
setReportErrors(boolean reportErrors)
Set the boolean indicating that the template should report errors. |
void |
setTemplatePage(String templatePage)
Set the URL of the template to use. |
Methods inherited from class AbstractClassicTag |
applyNamingChain, getErrorsReport, getIdForTagId, getNamingChain, getNearestForm, getNextId, getScriptReporter, getUserLocale, hasErrors, qualifyAttribute, registerTagError, registerTagError, reportAndExit, reportErrors, rewriteName, setNonEmptyValueAttribute, setRequiredValueAttribute, write |
Methods inherited from class BodyTagSupport |
doAfterBody, doInitBody, getBodyContent, getPreviousOut, release, setBodyContent |
Methods inherited from class TagSupport |
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface Tag |
getParent, setPageContext, setParent |
Template
public Template()
getTagName
public String getTagName()
- Returns the name of the Tag. This is used to
identify the type of tag reporting errors.
- Specified by:
getTagName
in interface INetuiTag
- Specified by:
getTagName
in class AbstractClassicTag
- Returns:
- the name of the tag.
setReportErrors
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
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.
setDocumentType
public void setDocumentType(String docType)
doStartTag
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.
- Specified by:
doStartTag
in interface Tag
- Overrides:
doStartTag
in class BodyTagSupport
- Returns:
- int indicating that the body should be evaluated.
- Throws:
JspException
- on errors.
doEndTag
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.
- Specified by:
doEndTag
in interface Tag
- Overrides:
doEndTag
in class BodyTagSupport
- Returns:
- SKIP_PAGE to skip all processing after the template.
- Throws:
JspException
- on all errors. The most common error is
an error indicating that the JSP page representing the Template
isn't found.
localRelease
protected void localRelease()
- Reset all of the fields of the tag.
- Overrides:
localRelease
in class AbstractClassicTag
addError
public void addError(AbstractPageError ape)
- Add an error to the errors being reported by this tag.
- Specified by:
addError
in interface IErrorReporter
- Parameters:
ape
- - The AbstractPageError to add
returnErrors
public ArrayList returnErrors()
- Return an ArrayList of the errors
- Specified by:
returnErrors
in interface IErrorReporter
- Returns:
- an
ArrayList
of all errors.
isReporting
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.
- Specified by:
isReporting
in interface IErrorReporter
- Returns:
- a boolean indicating if the tag is reporting errors or not.