11.javaweb Internationalization Tag Library

Source: Internet
Author: User
Tags string back

I. International TAG Library

1, formatting tags provided by the tag library

2, Label detailed

2.1<fmt:setlocale> Label

The following sets the different areas and displays the dates under the set area

2.2<fmt:requestencoding> Label

2.3 Reading resource Files

First, create a resource file under the Web-inf/classes folder resource.properties

{0} represents a placeholder that can be set dynamically by <fmt:param>

Where Chinese needs to be encoded, you can use the Exlipse tool kit in the self-contained transcoding tool

Then set the name of the resource file to read through <fmt:bundle>

When the <fmt:bundle> tag is set to read the resource file name, you can use the <fmt:message> tag to read the value by key

Read Resource Example

Resource file

Read resources: Notice the difference between <fmt:bundle> and <fmt:setBundle>

JSP page


2.4 Digital formatting Tags <fmt:formatNumber> and digital anti-formatting tags <fmt:parseNumber>

<fmt:formarnumber>, formatting the specified number

<fmt:parsenumber>, to eliminate the format of numbers, as follows

2.5 Date Formatting Tags <fmt:formatDate>

Usage examples

JSP page

2.6<fmt:parsedate> Label

function:<fmt:formatdate> is to change a Date object to a string, and <fmt:parseDate> to convert a string back to the date type data

Property

Use example: To change the previous long and custom date strings back to date data, you need to provide the string's pattern or style type when converting

2.7<fmt:settimezone> Label

Features: Set the displayed time zone and store the set time zone in a domain

Grammar:

<fmt:settimezone value= "time zone (used to set where to display)" >

<!--time display action--

</fmt:setTimeZone>

Three, summary

11.javaweb Internationalization Tag Library

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.