Formatting Tags
The formatting tags are used for internationalization and localization of the jsp pages. Internationalization provides support for various languages and data formats. By localization web applications becomes capable of supporting specific regions or locale.
1). <fmt:message>
This tag is used to output locale sensitive strings. The param subtag along with message provides an argument to the compound message in parent message tag. One param tag must be specified for each variable in the compound message or pattern. Replacement takes place in order of the param tags.
Syntax: <fmt:message key = "messageKey"
[bundle="resourceBundle"]
[var="varName"]
[scope="{page|request|session|application}"] />
2). <fmt:setLocale>
This tag is used to set the default locale within a specific JSP scope.
<fmt:setLocale value = "en_US" />
3). <fmt:bundle>
This tag is used to create an i18n localization context to be used by its body content.
Syntax: <fmt:bundle basename = "basename="basename"
[prefix="prefix"]>
body content
</fmt:bundle>
It creates an i18n localization context and loads its resource bundle into that context. The name of the resource bundle is specified with the basename attribute.
4). <fmt:setBundle>
This tag creates an i18n localization context and loads its resource bundle into that context. The name of the resource bundle is specified with the basename attribute.
Syntax: <fmt:setBundle basename = "basename"
[var="varname"]
[scope="{page|request|session|application}"]/>
5). <fmt:param>
This tag is used for parametric replacement to <fmt:message> tag.
Syntax: <fmt:param value="messageParameter"/>
6). <fmt:requestEncoding>
This tag is used to set the request's character encoding
Syntax: <fmt:requestEncoding [value="charsetName"]/>
7). <fmt:timeZone>
This tag is used to specify the time zone in which time information is to be formatted or parsed in its body content.
Syntax: <fmt:timeZone value="timeZone">
body content
</fmt:timeZone>
8). <fmt:setTimeZone>
This tag is used to store specified time zone in a scoped variable or the time zone configuration variable.
Syntax: <fmt:setTimeZone value="timeZone"
[var="varName"]
[scope="{page|request|session|application}"] />
9). <fmt:formatNumber>
This tag is used to format a numeric value in a locale-sensitive or customized manner as a number, currency etc.
Syntax: <fmt:formatNumber value = "numericValue"
[type="{number|currency|percent}"]
[pattern="customPattern"]
[currencyCode="currencyCode"]
[currencySymbol="currencySymbol"]
[goupingUsed="{true|false}"]
[scope="{page|request|session|application}"] />
10). <fmt:parseNumber>
This tag is used to parse the string representation of numbers, currencies, and percentages that were formatted in a locale-sensitive or customized manner.
Syntax: <fmt:parseNumber value="numericValue"
[type="{number|currency|percent}"]
[pattern="customPattern"]
[parseLocale="parseLocale"]
[integerOnly="{true|false}"]
[var="varName"]
[scope="{page|request|session|application}"]/>
11). <fmt:formatDate>
This tag is used to format date and time according to the locale.
Syntax: <fmt:formatDate value="date"
[type="{time|date|both}"]
[dateStyle="{default|short|medium|long|full}"]
[timeStyle="{default|short|medium|long|full}"]
[pattern="customPattern"]
[timeZone="timeZone"]
[var="varName"]
[scope={page|request|session|application}"] />
12). <fmt:parseDate>
Parses the string representation of dates and time that were formatted for a specific locale.
Syntax: <fmt:parseDate value = "dateString"
[type="{time|date|both}"]
[dateStyle="{default|short|medium|long|full}"]
[timeStyle="{default|short|medium|long|full}"]
[pattern="customPattern"]
[timeZone="timeZone"]
[parseLocale="parseLocale"]
[var="varName"]
[scope={page|request|session|application}"] />