BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.template
Class Attribute

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.bea.wlw.netui.tags.template.Attribute
All Implemented Interfaces:
TemplateConstants, Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class Attribute
extends javax.servlet.jsp.tagext.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
AttributeRequiredRuntime Expression Evaluation Data Bindable
defaultValueNoNoNo
A default value used for the Attribute if the content page does not provide a value.
nameYesNoNo
The name identifying the Attribute. Any named attribute may be used more than once within a template page.

See Also:
IncludeSection, Section, SetAttribute, Template, Visible, Serialized Form
Example:

In 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">

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_template/template/template.jsp
Beadoc.see:
<netui-template:...> Tags Sample
Beadoc.tagdescription:
The <netui-template:attribute> tag defines a placeholder within a template. The value of these placeholders may be set from a content page.

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

Attribute

public Attribute()
Method Detail

setName

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.
Beadoc.attributedescription:
The name for the <netui-template:attribute> placeholder. The name may be used more than once in a template page.
Beadoc.attributesyntaxvalue:
string_name
Beadoc.databindable:
false

getName

public String getName()
Returns the name of the Attribute.

Returns:
the name of the Attribute

setDefaultValue

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.
Beadoc.attributedescription:
The default value for <netui-template:attribute> placeholder. If a content page does not define a value for the placeholder through its <netui-template:setAttribute> tag, then the defaultValue will be used. If neither a value nor defaultValue is set, then the empty String "" will be output.
Beadoc.attributesyntaxvalue:
string_defaultValue
Beadoc.databindable:
false

getDefaultValue

public String getDefaultValue()
Returns the defaultValue of the Attribute.

Returns:
a String value representing the default value.

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Renders the content of the attribute.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
EVAL_PAGE to continue evaluation of the page.
Throws:
javax.servlet.jsp.JspException - If there is any failure in the tag.

localRelease

protected void localRelease()
Resets all of the fields of the tag.


BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.