In this tutorial you will learn about the JSTL fmt tags.
JSTL fmt Tag Library
In this tutorial you will learn about the JSTL fmt tags.
JSTL fmt tag is also called an i18n (Internationalization) tag library. Tags in this library facilitates you to design your web applications in a locale-sensitive manner i.e. the language and formatting conventions of client locales. In simple we can say tags in this library are used for supporting the internationalization in JSP. Tags in the JSTL fmt tag library is defined for a page to set the locale, create the locale-sensitive message, formats and parse the data elements (numbers, date, currencies etc), and set the time in a locale-sensitive manner or in the customized manner.
Before using the tags of this library you would be required to add the the following taglib on your JSP page :
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
This is a standard syntax for using the tags of JSTL fmt tag library.
fmt tags can be classified on the basis of their functional area these are as follows :
Function | Tags |
Setting Locale | setLocale, requestEncoding |
Messaging | bundle, message, param, setBundle |
Number and Date Formatting |
formatNumber, formatDate, parseDate, parseNumber, setTimeZone, timeZone |
To localize the data fmt tags of JSTL uses the localization context, this context keeps the instances of a Locale and a ResourceBundle.
Above table describes that each tag has its own work purpose i.e they are defined as according to their functions such as :
setLocale : This tag is used for storing the specified locale in configuration variable of locale.
requestEncoding : This tag is used for setting the request character encoding.
bundle : The resource bundle is loaded by this tag which will be used by its tag body.
message : key from the key-value localized message is mapped by this tag and does the parametric replacement.
param : This tag is used for providing an argument to a <message> tag for doing the parametric replacement.
setBundle : A resource bundle is loaded by this tag and is stored into the bundle configuration variable or the named scoped variable.
formatNumber : Numeric values are formatted by this tag.
parseNumber : String representation of number, currency, percentage is parsed by this tag.
parseDate : String representation of date and/or time is parsed by this tag.
formatDate : With the help of provided styles and pattern date and/or time is formatted by this tag.
setTimeZone : This tag is used for setting the provided time zone.
timeZone : This tag is used for defining the time zone, it doesn't matter what the time formatting is used or parsing actions that are nested in its body.
[ 0 ] Comments