netui:label Tag

<netui:label> Tag

Generates styled text based on a String literal or data binding expression.

Syntax

<netui:label
    [dataformatas="string_dataFormatAs"]
    [defaultValue="string_defaultValue"]
    [escapeWhiteSpaceForHtml="boolean_escapeWhiteSpace"]
    [id="string_id"]
    [onClick="string_onClick"]
    [onDblClick="string_onDblClick"]
    [onKeyDown="string_onKeyDown"]
    [onKeyPress="string_onKeyPress"]
    [onKeyUp="string_onKeyUp"]
    [onMouseDown="string_onMouseDown"]
    [onMouseMove="string_onMouseMove"]
    [onMouseOut="string_onMouseOut"]
    [onMouseOver="string_onMouseOver"]
    [onMouseUp="string_onMouseUp"]
    [style="string_Style"]
    [styleClass="string_Class"]
    [tabindex="string_tabIndex"]
    [tagId="string_tagId"]
    value="string_or_expression_value" />

Description

Generates styled text based on a String literal or data binding expression.

The <netui:label> tag is similar to the <netui:content> tag, except with respect to the way that it treats characters sensitive to HTML browsers. The <netui:label> tag filters the input string for browser-sensitive characters and replaces these characters with the corresponding entity strings. For example, if you pass the string '&amp;' to a <netui:label> tag, the string '&amp;amp;' will be written to the HTML source file, and the following will be displayed in the browser: '&amp;'.

The following table shows how the <netui:label> and <netui:content> tags treat HTML-sensitive characters.

tag generated HTML source displayed in browser
<netui:content value="&amp;"/> &amp; &
<netui:label value="&amp;"/> &amp;amp; &amp;

Note: escaping is not applied to browser-sensitive characters in the defaultValue attribute.

Attributes

dataformatasThe data format of the output.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

defaultValueA literal or data binding expression default value that will be used in the event that the value attribute resolves to NULL. If the defaultValue is an expression, then any format tags (<netui:formatString>, etc.) will be applied to the value. If the defaultValue is not an expression, format tags will not be applied. If the defaultValue contains an entity string, such as "&nbsp;", then the default value is output without applying any escaping to it.
 
RequiredSupports runtime expression evaluationData bindable
NoNoRead Only

escapeWhiteSpaceForHtmlBoolean. If set to true, white space will be escaped before it is output to the page. Default value is false.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

idThe id attribute is deprecated, use the tagId attribute instead. The id attribute of the rendered HTML tag. You should use the tagId attribute which will encode the id correctly for containers such as the Portal which needs to rewrite id's to make them unique.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

onClickThe onClick JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onDblClickThe onDblClick JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onKeyDownThe onKeyDown JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onKeyPressThe onKeyPress JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onKeyUpThe onKeyUp JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onMouseDownThe onMouseDown JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onMouseMoveThe onMouseMove JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onMouseOutThe onMouseOut JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onMouseOverThe onMouseOver JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

onMouseUpThe onMouseUp JavaScript event.
 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

styleSets the style of the rendered HTML tag.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

styleClassThe class of the rendered HTML tag.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

tabindexThe tabIndex of the rendered HTML tag. This attribute determines the position of the rendered HTML tag in the sequence of tags that the user may advance through by pressing the TAB key.
 
RequiredSupports runtime expression evaluationData bindable
NoNoNo

tagId

String value. Sets the id (or name) attribute of the rendered HTML tag. Note that the real id attribute rendered in the browser may be changed by the application container (for example, Portal containers may change the rendered id value to ensure the uniqueness of id's on the page). In this case, the real id rendered in the browser may be looked up through the JavaScript function getNetuiTagName( tagId, tag ).

For example, assume that some tag's tagId attribute is set to foo.

    <netui:textBox tagId="foo" />

Then the following JavaScript function will return the real id attribute rendered in the browser:

    getNetuiTagName( "foo", this )

To get a <netui:form> element and all of its children elements in JavaScript, use the same JavaScript function getNetuiTagName( tagId, tag ). For example, assume that there is a <netui:form> whose tagId attribute is set to bar.

    <netui:form tagId="bar" >

Then the following JavaScript function will return the <netui:form> element and its children (packaged as an array).

    document[getNetuiTagName( "bar", this )]

To retreive the value entered into a <netui:textBox> within the <netui:form> tag, use the following JavaScript expression.

    document[getNetuiTagName("bar", this)][getNetuiTagName("foo", this)].value

The second parameter ensures that the JavaScript function begins its search within the correct Portlet scope. Pass the JavaScript keyword this as the second parameter. For detailed information on using the function getNetuiTagName( tagId, tag ) see Using JavaScript in Page Flow and Portal Applications.

 
RequiredSupports runtime expression evaluationData bindable
NoYesNo

valueA literal or data binding expression.
 
RequiredSupports runtime expression evaluationData bindable
YesYesRead Only

Sample

In this first sample, a <netui:label> tag displays the Form Bean's firstName property. The <netui:label> tag will resolve this data binding expression, and display its value.
    <netui:label value="{actionForm.firstName}" />

In this next sample, the value attribute will resolve to null. This causes the defaultValue to be displayed. The user will see ' '.

    <netui:label value="{pageFlow.somethingNull}" defaultValue="&nbsp;"/>

In this next sample, the HTML will contain the text "&amp;nbsp;" and the user will see '&nbsp;'

    <netui:label value="{pageFlow.somethingNull}" defaultValue="&amp;nbsp;"/>

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui/label/

Related Topics

<netui:label> Tag Sample

<netui:content> Tag