|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.jsp.tagext.TagSupport com.bea.wlw.netui.tags.template.Attribute
public class Attribute
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. |
IncludeSection
,
Section
,
SetAttribute
,
Template
,
Visible
,
Serialized FormIn this sample, a <netui-template:attribute> tag defines a value placeholder within a <td> tag
<td colspan="3" bgcolor="<netui-template:attribute name="headerColor" defaultValue="#ffffff"/>">
Now a content JSP page can control the background color of the <td>.
<netui-template:setAttribute name="headerColor" value="lightgreen"/>The HTML rendered in the browser will appear as follows.
<td colspan="3" bgcolor="lightgreen">
For example, a title placeholder may be defined in the template.
In the template JSP page...
<head> <title> <netui-template:attribute name="title"/> </title> </head>
Then content pages may set the value of this placeholder using the
SetAttribute
tag.
In a content JSP page...
<netui-template:setAttribute name="title" value="myContentPage1.jsp"/>
The HTML rendered in the browser appears as follows.
Rendered HTML in the browser...
<head> <title> myContentPage1.jsp </title> </head>If the <netui-template:setAttribute> tag specifies no value to be set in the placeholder, then the
Attribute
tag's defaultValue
will be used.
<netui-template:attribute name="title" defaultValue="My Page"/>The <netui-template:attribute> tag may also be used to define placeholders within JSP and HTML tags.
In the template JSP page...
<td colspan="3" bgcolor="<netui-template:attribute name="headerColor" defaultValue="#ffffff"/>">
Field Summary |
---|
Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
id, pageContext |
Fields inherited from interface com.bea.wlw.netui.tags.template.TemplateConstants |
---|
TEMPLATE_ATTRIBUTES, TEMPLATE_SECTIONS |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
Attribute()
|
Method Summary | |
---|---|
int |
doStartTag()
Renders the content of the attribute. |
String |
getDefaultValue()
Returns the defaultValue of the Attribute . |
String |
getName()
Returns the name of the Attribute . |
protected void |
localRelease()
Resets all of the fields of the tag. |
void |
setDefaultValue(String defaultValue)
Sets the defaultValue for the Attribute . |
void |
setName(String name)
Sets the name for the Attribute . |
Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
---|
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Attribute()
Method Detail |
---|
public void setName(String name)
name
for the Attribute
. An
attribute may be used more than once in a template page.
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.name
for the <netui-template:attribute> placeholder. The name
may be used more than once in a template page.public String getName()
name
of the Attribute
.
Attribute
public void setDefaultValue(String defaultValue)
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.
defaultValue
- The value to set the defaultValue property.defaultValue
will be used.
If neither a value nor defaultValue
is set, then the
empty String "" will be output.public String getDefaultValue()
defaultValue
of the Attribute
.
String
value representing the default value.public int doStartTag() throws javax.servlet.jsp.JspException
doStartTag
in interface javax.servlet.jsp.tagext.Tag
doStartTag
in class javax.servlet.jsp.tagext.TagSupport
javax.servlet.jsp.JspException
- If there is any failure in the tag.protected void localRelease()
|
BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |