Common JSTL FMT (format formatted) label usage Collation _jsp programming in JSP

Source: Internet
Author: User
Tags i18n locale

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.
The features and usage of these tags will be described in detail.

<fmt:formatNumber> Label

Format numbers as numbers, currencies, or percentages by region or custom

 <fmt:formatnumber value= "number" [type={number|currency|percent|}]

[pattern= "pattern"]

[currencycode= "CurrencyCode"]

[currentsymbol= "Currentsymbol"]

[groupingusec= ' {true|false} ']

[maxintergerdigits= "Maxintergerdigits"]

[minintergerdigits= "Minintergerdigits"]

[maxfractiondigits= "Maxfractiondigits"]

[minfractiondigits= "Minfractiondigits"]

[var= "VarName"] [scope= "Page|request|session|application"]/> 
<% @page language= "java" contenttype= "Text/html;charset=utf-8"%> <%@ taglib uri=
"http://java.sun.com/ Jsp/jstl/fmt "prefix=" FMT "%>
<! DOCTYPE html>
 
 

<fmt:parsenumber/> Label

Converts the number, currency, or percentage of a string type to a numeric type

<fmt:parsenumber value= "numberstring" [type={number|currency|percent|}]

[pattern= "pattern"]

[parselocale= "Parselocale"]

[integeronly= ' {false|true} ']

[var= "VarName"]

[scope= "Page|request|session|application"]

 />

<fmt:formatdate/> Label

Used to convert a date type to a string type date

<fmt:formatdate value= "Number" [Type={time|date|both}]

[pattern= "pattern"]

[datestyle=] {default| Short|medium|long|full} "]

[timestyle= ' {default|short|medium|long|full} ']

[timezone= ' TimeZone ']

[var= "VarName"]

[scope= "Page|request|session|application"]

 />

<fmt:parsedate/> Label

Used to convert the time or date of a string type to a date time type

<fmt:parsedate value= "Date" [Type={time|date|both}]

[pattern= "pattern"]

[datestyle=] {default|short| Medium|long|full} "]

[timestyle= ' {default|short|medium|long|full} '] [

timezone= ' TimeZone '] [

var=] VarName "]

[scope=" page|request|session|application "]

 />

<fmt:settimezone/> Label

Used to set the default time zone or store the time zone in the attribute range

Copy Code code as follows:

<fmt:settimezone value= "TimeZone" [var= "varname"] [scope= ' {page|request|session|application} ']/>

<fmt:timezone/> Label
Used to set the time zone temporarily
<fmt:timezone value= "TimeZone" >

ontology content

</fmt:timeZone>

<fmt:setlocale/> Label

Used to set the locale language of the user

Copy Code code as follows:

<fmt:setlocale value= "Locale" [variant= "variant"] [scope= ' {page|request|session|application} ']/>

<fmt:requestencoding/> Label
Sets the encoded format of the received string
<fmt:requestencoding value= "CharsetName"/>

<fmt:setbundle/> Label

Used to set the default data source, or to store it in a range that you want to use

Copy Code code as follows:

<fmt:setbundle basename= "basename" [var= "varname"] [scope= ' {page|request|session|application} ']/>

<fmt:message/> Label

Used to get values from the specified resource file through the index

Copy Code code as follows:

<fmt:message key= "Messagekey" [bundle= "ResourceBundle"] [var= "varname"] [scope=] {page|request|session| Application} "]/>

<fmt:param/> Label

Used to pass arguments (when obtaining information from a resource file, you may need to set parameters dynamically)

<fmt:param value= "Messageparameter"/>

No ontology content

<fmt:param value= "Messageparameter" > has ontology content

parameters

</fmt:param>

<fmt:bundle/> Label

Used to set the data source

<fmt:bundle basename= "basename" [prefix= "prefix"] >

ontology content <fmt:message>

</fmt:bundle>

Related Article

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.