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 SetAttribute

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

public class SetAttribute
extends AbstractBaseTag
implements TemplateConstants

Set an Attribute value defined in a template. This tag is used in content pages to set the value of attributes defined in a template. The attribute value will override any default value defined on the Attribute.

Attribute Descriptions
AttributeRequiredRuntime Expression Evaluation Data Bindable
nameYesNoNo
The name of the Attribute in the template for which this tag sets a value for.
valueYesNoRead Only
The value of the Attribute. This may be either a String value or an expression.

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

Assume 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:setAttribute> tag sets the value for a placeholder in a template page.

The <netui-template:setAttribute> tag must have a parent Template tag.

The target placeholder is defined by a Attribute tag. For a value to be set in the placeholder, the <netui-template:attribute> and <netui-template:setAttribute> tags must have matching name attributes.

For example, a 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 <netui-template: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 <netui-template: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 com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
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 com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
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
SetAttribute()
           
 
Method Summary
 int doStartTag()
          Tag Lifecycle method called when the tag is first seen.
 String getName()
          Return the name of the Attribute we are setting an value for.
 String getTagName()
          Return the name of the tag.
 String getValue()
          Return the value value.
protected  void localRelease()
          Reset all of the fields of the tag.
 void setName(String name)
          Set the name of the attribute.
 void setValue(String value)
          Set the value of the Attribute.
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doAfterBody, doEndTag, doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Constructor Detail

SetAttribute

public SetAttribute()
Method Detail

getTagName

public String getTagName()
Return the name of the tag. This is used by error reporting in the base class AbstractBaseTag.

Specified by:
getTagName in class AbstractBaseTag

setName

public void setName(String name)
Set the name of the attribute.

Parameters:
name - The name of the Attribute in the template for which this tags sets the value.
Beadoc.attributedescription:
The name of the attribute to set.
Beadoc.attributesyntaxvalue:
string_name
Beadoc.databindable:
false

getName

public String getName()
Return the name of the Attribute we are setting an value for.

Returns:
A String value representing the name of the Attribute.

setValue

public void setValue(String value)
Set the value of the Attribute. This attribute may be assigned a read only expression.

Parameters:
value - The value to use for the Attribute in the template.
Beadoc.attributedescription:
Sets the value of the attribute.
Beadoc.attributesyntaxvalue:
string_or_expression_value
Beadoc.databindable:
Read Only

getValue

public String getValue()
Return the value value. If the value is an expression, the expression will be returned, not the value referred to by the expression.

Returns:
a String value representing the Attribute value.

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Tag Lifecycle method called when the tag is first seen. This method will add the Attribute value to a HashMap stored in the request allowing the template to access the value. If there are errors, the error text will be placed into the attribute value. Nothing is written into the ServletResponse

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE to continue processing the page.
Throws:
javax.servlet.jsp.JspException - on error

localRelease

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

Overrides:
localRelease in class AbstractBaseTag

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