One: The JSTL format label, also known as the i18n tag library, is used primarily to write internationalized Web applications that can be appropriately processed for a specific language request.
For example: Chinese mainland users will display Simplified Chinese, Taiwan is the traditional Chinese, the use of i18n format Tag library can also format numbers and dates, such as the same number or increasingly, in different countries may have different formats, using the I18N format tag library can format numbers and dates in the local format.
Two: Format label
<fmt:fromatNumber>
<fmt:formatDate>
<fmt:parseDate>
<fmt:parseNumber>
<fmt:setTimeZone>
<fmt:timeZone>
Internationalization label
<fmt:setLocale>
<fmt:requestEncoding>
<fmt:bundle>
<fmt:message>
<fmt:param>
<fmt:setBundle>
To use a format tag in a JSP page, you need to introduce the following statement:
<%@ taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"% >
Three:<fmt:formatnumber>
This label formats the number as a number, currency, or percentage, based on the locale customization.
Properties of this label:
Value: the number to format
Type: Format by what
Pattern: Customizing formatting styles
currencycode:iso-4721 currency codes, applicable only to numbers formatted with currency
CurrencySymbol: Currency symbols, such as ¥, that apply only to numbers formatted with currency
Groupingused: whether to include delimiters
Maxintegerdigits: The maximum number of digits displayed in the integer section
Mixintegerdigits: The minimum number of bits shown in the integer section
Maxfractiondigits: The fractional portion displays up to multiple digits
Minfractiondigits: The decimal portion displays at least multiple digits
var: storage-formatted results
Scope: The range of storage
Example 1:
Java code
<%@ page language= "java" pageencoding= "Utf-8"%>
<%@ taglib uri= "Http://java.sun.com/jsp/jstl/core" prefix= "C"%>
<%@ taglib uri= "http://java.sun.com/jsp/jstl/fmt" prefix= "FMT"%>
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
<title>chapter4.jsp</title>
<body>
<div>
<div>
<fmt:setlocale value= "Fr_fr"/>
<fmt:formatnumber value= "123456789.012"/>
<br/>
<fmt:setlocale value= "Zh_cn"/>
<fmt:formatnumber value= "123456789.012"/>
<br/>
<fmt:setlocale value= "De_de"/>
<fmt:formatnumber value= "123456789.012"/>
<br/>
</div>
</div>
</body>