NetUI Tag Library Documentation (Version 1.0.2)

netui-template
netui-template:attribute Tag

Defines a property placeholder within a template.

Syntax

<netui-template:attribute
    [defaultValue="string_defaultValue"]
    name="string_name" >
    ... JSP content ...
</netui-template:attribute>

Description

Defines a property 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 <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"/>">

Attributes
defaultValue
Required: No  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

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.
name
Required: Yes  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

The name for the <netui-template:attribute> placeholder. The name may be used more than once in a template page.

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


Tag Information
Tag Classorg.apache.beehive.netui.tags.template.Attribute
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone