O'Reilly logo

JavaServer Pages, Second Edition by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

<fmt:formatNumber>

Synopsis

The <fmt:formatNumber> action formats a numeric value according to locale-specific rules. A custom pattern can be specified, or the locale-dependent default pattern for a certain number type (currency, percentage, or a regular number) can be used as a starting point and optionally adjusted (currency code, maximum, and minimum number of digits and fractional digits, grouping character or not).

The locale is taken from the locale configuration setting or from the localization context setting. If neither is set, the locale is determined as the best match for the user preferences (Accept-Language request header).

Syntax 1: Without a body

<fmt:formatNumber value="number" 
  [pattern="pattern" |
    [type="number|currency|percent"]
    [currencyCode="currencyCode" | currencySymbol="currencySymbol"]
    [groupingUsed="true|false"]
    [minIntegerDigits="min"] [maxIntegerDigits="max"]
    [minFractionDigits="min"] [maxFractionDigits="max"]]
  [var="var" [scope="page|request|session|application"]] />

Syntax 1: With a body

<fmt:formatNumber 
  [pattern="pattern" |
    [type="number|currency|percent"]
    [currencyCode="currencyCode" | currencySymbol="currencySymbol"]
    [groupingUsed="true|false"]
    [minIntegerDigits="min"] [maxIntegerDigits="max"]
    [minFractionDigits="min"] [maxFractionDigits="max"]]
  [var="var" [scope="page|request|session|application"]]>
  number
</fmt:formatNumber>

Attributes

Attribute name

Java type

Dynamic value

accepted

Description

value

String orNumber

Yes

The value to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required