Name

<fmt:parseNumber>

Synopsis

The <fmt:parseNumber> action parses a number formatted according to locale-specific rules. A custom pattern can be specified or a locale specific default pattern for a certain number type (currency, percentage, or a regular number) can be used.

The locale used is the one explicitly specified or is taken from the locale configuration setting or the locale from the localization context setting. If none of these are set, the locale is determined as the best match for the user preferences (Accept-Language request header).

Syntax 1: Without a body

<fmt:parseNumber value="number" 
  [pattern="pattern" | type="number|currency|percent"]
  [parseLocale="locale"]
  [integerOnly="true|false"]
  [var="var" [scope="page|request|session|application"]] />

Syntax 1: With a body

<fmt:formatNumber 
  [pattern="pattern" | type="number|currency|percent"]
  [parseLocale="locale"]
  [integerOnly="true|false"]
  [var="var" [scope="page|request|session|application"]]>
  number
</fmt:parseNumber>

Attributes

Attribute name

Java type

Dynamic value accepted

Description

value
String

Yes

The value to parse.

pattern
String

Yes

A custom pattern in the form accepted by java.text.DecimalFormat, see fmt:formatNumber.

type

String

Yes

The name of one of the predefined locale-dependent patterns.

parseLocale

String or java.util.Locale

Yes

A locale to be used instead of the default.

integerOnly

boolean

Yes

Set to true to parse only the integer portion.

var

String

No

The variable ...

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.