NetUI Tag Library Documentation (Version 1.0.1)

netui
netui:formatNumber Tag

A formatter used to format numbers.

Syntax

<netui:formatNumber
    [country="string_country"]
    [language="string_language"]
    [pattern="string_pattern"]
    [type="string_type"] />

Description

A formatter used to format numbers.

The <netui:formatNumber> tag formats the output of its parent tag. For example:

    <netui:span value="${pageFlow.price}">
        <netui:formatNumber country="FR" language="fr" type="currency" />
    </netui:span>

The pattern attribute conforms to DecimalFormat pattern syntax.

The pattern attribute uses the comma as a grouping separater. If many different grouping sizes are specified in one pattern, the right-most grouping interval will be used throughout; the other grouping intervals will be ignored. For example, the following format patterns all produce the same result. If the number to format is 123456789, each will produce 123,456,789.

The type attribute specifies three common kinds of formatting to be applied to the number. The valid values for the type attribute are:

The country attribute takes an upper-case, two-letter code as defined by ISO-3166.

The language attribute takes a lower-case, two-letter code as defined by ISO-639.

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

Sets the country code for the locale.
language
Required: No  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

Sets the language code for the locale.
pattern
Required: No  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

Sets the pattern to be used by this format tag. (See the tag description)
type
Required: No  |   Type: String  |   Supports runtime evaluation / JSP Expression Language: Yes

The type of the format to apply. Possible values are number, currency, or percent.

Example

In this first example, the value "12345678" is formatted to 12,345,678.00.

    <netui:span value="12345678">
        <netui:formatNumber pattern="#,###.00" />
    </netui:span>

In the next sample, the value ".33" is formatted to 33%.

    <netui:span value=".33">
        <netui:formatNumber type="percent" />
    </netui:span>

In the next sample, the value "14.317" is formatted to $14.32.

    <netui:span value="14.317">
        <netui:formatNumber country="US" language="en" type="currency" />
    </netui:span>


Tag Information
Tag Classorg.apache.beehive.netui.tags.html.FormatNumber
TagExtraInfo ClassNone
Body Contentempty
Display NameNone