org.apache.beehive.netui.tags.template
Class Section
Object
TagSupport
BodyTagSupport
AbstractClassicTag
Section
- All Implemented Interfaces:
- Serializable, BodyTag, IterationTag, JspTag, Tag, INetuiTag, TemplateConstants
public class Section
- extends AbstractClassicTag
- implements TemplateConstants
Used within a content page to provide content for a placeholder
section defined within a template. The body content of the tag
is passed to the IncludeSection
tag in the template
providing the content for that section.
If the name
attribute matches a
name
attribute on a
IncludeSection
tag in the template, the body
content of this tag will be rendered.
- See Also:
- Serialized Form
- Example
- Assume a <netui-template:includeSection> tag defines a content placeholder inside a
table row
<tr>
<netui-template:includeSection name="rowPlaceholder"/>
</tr>
A content page can set content into the placeholder using the <netui-template:section>
tag as follows.
<netui-template:section name="rowPlaceHolder">
<td><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut laoreet dolore
magna aliquam erat volutpat. Ut wisi enim ad minim veniam,
quis nostrud exerci tation ullamcorper suscipit lobortis nisl
ut aliquip ex ea commodo consequat.</p></td>
</netui-template:section>
The HTML rendered in the browser will appear as follows.
<tr>
<td><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut laoreet dolore
magna aliquam erat volutpat. Ut wisi enim ad minim veniam,
quis nostrud exerci tation ullamcorper suscipit lobortis nisl
ut aliquip ex ea commodo consequat.</p></td>
</tr>
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 |
int |
doEndTag()
Stores the buffered body content into the TEMPLATE_SECTIONS
HashMap . |
int |
doStartTag()
Causes the content of the section to be rendered into a buffer. |
String |
getTagName()
Returns the name of the Tag. |
protected void |
localRelease()
Resets all of the fields of the tag. |
void |
setName(String name)
Sets the name of the placeholder section defined in
the template that this tag is providing content for. |
void |
setVisible(boolean visible)
Sets the visible state of the tag. |
Methods inherited from class AbstractClassicTag |
applyNamingChain, getErrorsReport, getIdForTagId, getNamingChain, 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 |
Section
public Section()
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:
- a constant string representing the name of the tag.
setName
public void setName(String name)
- Sets the name of the placeholder section defined in
the template that this tag is providing content for.
This name is matched against the
IncludeSection
name. If the names match, the content of this tag will be
rendered within the template's section.
- Parameters:
name
- The name of an IncludeSection the
this tag is providing content for.
setVisible
public void setVisible(boolean visible)
- Sets the visible state of the tag.
- Parameters:
visible
- Boolean
value representing the visible state.
doStartTag
public int doStartTag()
throws JspException
- Causes the content of the section to be rendered into a buffer.
- Specified by:
doStartTag
in interface Tag
- Overrides:
doStartTag
in class BodyTagSupport
- Returns:
- SKIP_BODY if the visible state is
false
,
otherwise EVAL_BODY_BUFFERED to cause the body content to be buffered.
- Throws:
JspException
- if there are errors.
doEndTag
public int doEndTag()
throws JspException
- Stores the buffered body content into the
TEMPLATE_SECTIONS
HashMap
. The buffered body is
accessed by the template page to obtain
the content for IncludeSection
tags.
- Specified by:
doEndTag
in interface Tag
- Overrides:
doEndTag
in class BodyTagSupport
- Returns:
- EVAL_PAGE to continue evaluating the page.
- Throws:
JspException
- on error.
localRelease
protected void localRelease()
- Resets all of the fields of the tag.
- Overrides:
localRelease
in class AbstractClassicTag