Jstl Tag Library (2) i18n format Tag Library

Source: Internet
Author: User
Tags date i18n integer

I18N Format Tag Library

The JSTL tag provides support for internationalization (i18n), which can display different languages depending on the client domain that makes the request. It also provides a way to format data and dates.

Implementing these features requires the I18N Format Tag library (i18n-capable formation tags liberary). The method for introducing the tag library is:

<%@ taglib prefix= "FMT" uri= "Http://java.sun.com/jsp/jstl/fmt"%>

The I18N Format Tag library provides 11 tags, which can be functionally divided into 3 categories as follows:

(1) Date format of the number. FormatNumber tags, formatdata tags, parsenumber tags, parsedate tags, timezone tags, settimezone tags.

(2) Read the message resource. Bundle label, message label, Setbundle label.

(3) Internationalization. SetLocale label, requestencoding label.

1 Digital Date format

Numeric date format Labels There are 6 of them, used to convert numbers or dates to the format you set.

1.1<frm:formatnumber/> Label

The label is displayed by changing the number to a different format based on a specific area.

"Syntax 1":

<frm:formatnumber value= "formatted data" [type= "Number|currency|percent"]  
 [pattern= "pattern"]  
 [currencycode= "Code"  
 [currencysymbol= "symbol"]  
 [groupingused= "True|false"]  
 [maxintergerdigits= "Maxdigits"]  
 [minintergerdigits= "Mindigits"]  
 [maxfractiondigits= "Maxdigits"]  
 [minfractiondigits= "Mindigits"]  
 [var= ' name ']  
 [Scope=page|request|session|application]  
/>

"Syntax 2":

<frm:formatnumber [type= "Number|currency|percent"]  
 [pattern= "pattern"]  
 [currencycode= "code"]  
 [currencysymbol= "symbol"]  
 [groupingused= "True|false"]  
 [maxintergerdigits= "Maxdigits"]  
 [minintergerdigits= "Mindigits"]  
 [maxfractiondigits= "Maxdigits"]  
 [minfractiondigits= "Mindigits"]  
 [var= ' name ']  
 [Scope=page|request|session|application]

> Formatted Data <frm:formatNumber>

Attribute Description <fmt:formatNumber> Label parameter description

Name: Description: EL: Type: must: Default value

Value: Data to format: Yes: String: Yes: none

Type: Specifies types (units, currencies, percentages, and so on): yes: No: Number

Pattern: Formatted data style: is: String: No: None

CurrencyCode: Currency Unit code: Yes: No: No

Cuttencysymbol: Currency symbol ($, ¥): is: String: No: None

Groupingused: Whether to group integer parts as (9,999): Yes: Boolean: Yes: True

Maxintergerdigits: Number of digits of the most pairs of integers: yes: int: no: None

Minintergerdigits: Minimum number of digits in the integer section: yes: int: no: None

Maxfractiondigits: The number of decimal parts to display most digits: yes: int: no: None

Minfractiondigits: Minimum number of decimal digits: yes: int: no: None

VAR: Storing formatted data: No: String: No: None

Scope:var's JSP range: No: String: No: Page

Type application of the types attribute

Type: Description: Example

Number: Digital format: 0.8

Currency: Local Currency: ¥0.80

Percent: Percent format: 80%

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.