Attribute Class
- public class Attribute
extends TagSupport
implements TemplateConstants
The Attribute tag defines an attribute within a template that may be set
from a content page. For example, the page's title may be defined as an
attribute in the template and then provided by each content page using the
template. The attribute has a name and default value. If the content
page specifies a value for the attribute it will be used, otherwise
the default value is used.
Attribute Descriptions |
Attribute | Required | Runtime Expression Evaluation |
Data Bindable |
defaultValue | No | No | No |
A default value used for the Attribute if
the content page does not provide a value. |
name | Yes | No | No |
The name identifying the Attribute. Any named
attribute may be used more than once within a template page. |
Related Topics
<netui-template:...> Tags Sample
IncludeSection
Section
SetAttribute
Template
Visible
-
Hierarchy
-
Object
TagSupport
Attribute
-
All Implemented Interfaces
-
IterationTag
, Serializable
, Tag
, TemplateConstants
Methods from javax.servlet.jsp.tagext.TagSupport |
doAfterBody, doEndTag, 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 |
Attribute
public Attribute()
doStartTag() Method
public int doStartTag()
throws JspException
Renders the content of the attribute.
-
Overrides
-
TagSupport.doStartTag()
Returns
- EVAL_PAGE to continue evaluation of the page.
Exceptions
-
JspException
- If there is any failure in the tag.
getDefaultValue() Method
public String
getDefaultValue()
Returns the defaultValue
of the Attribute
.
Returns
- a
String
value representing the default value.
getName() Method
public String
getName()
Returns the name
of the Attribute
.
Returns
- the name of the
Attribute
localRelease() Method
protected void localRelease()
Resets all of the fields of the tag.
setDefaultValue(String) Method
public void setDefaultValue(String
defaultValue)
Sets the defaultValue
for the Attribute
.
If the content page does not define a value for this attribute
through the SetAttribute
tag, then the
defaultValue
will be used.
If neither a value nor defaultValue
is set, then the
empty String "" will be output.
Parameters
-
defaultValue
- The value to set the defaultValue property.
setName(String) Method
public void setName(String
name)
Sets the name
for the Attribute
. An
attribute may be used more than once in a template page.
Parameters
-
name
- The name of the attribute. The name does
not need to be unique because it may be used more than once
on the page.