JSTL parsing -- 006 -- fmt tag library 01

Source: Internet
Author: User

The previous sections mainly explain the core tag library. Today we will begin to explain the fmt tag Library: fmt is the secondary function tag, and fmt is the full name of format1, <fmt: requestEncoding> the requestEncoding tag is used to set the request Encoding, which is equivalent to the request. setCharacterEncoding ("XX"); it is very simple to use, only one attribute of value <fmt: requestEncoding value = "GBK"/> 2. <fmt: setLocale> the setLocale tag is used to display the data formats of all regions. Locale indicates localization, it mainly serves to solve different formats of uniform content display in different regions and countries (time display problem: China's September 12, 2013, UK was NoverNumber 12,2013 11:12:12 AM, etc ), for the convenience of [html] <% request. setAttribute ("localeL Ist ", Locale. getAvailableLocales (); // first obtain the display format of each country and store it in localList. %> <jsp: useBean id = "date" class = "java. util. date "/> <c: forEach var =" locale "items =" $ {localList} "> <fmt: setLocale value =" $ {locale} "/>$ {locale. displayName} <fmt: formatDate value = "$ {date}" type = "both"/> </c: forEach> there is a difference between the time styles displayed once without loops 3. <fmt: timeZone> the tag timeZone shows the global time, except for the time affected by Locale (the time display format, it is also affected by the time zone (Time Value), [html] <% request. setAttribute ("local EList ", IimeZone. getAvailableIDs (); // obtain the time zone and store it in localList. %> <jsp: useBean id = "date" class = "java. util. date "/> <c: forEach var =" ID "items =" $ {localList} "> <fmt: timeZone value =" $ {ID} ">$ {locale. displayName} <fmt: formatDate value = "$ {date}" type = "both" timezone = "$ {ID}"/> [html] </fmt: timeZone </c: forEach> [html] view plaincopyprint? Note that timeZone only applies to the code inside the tag. 4. The <fmt: setTimeZone> tag setTimeZone is a supplement to the timeZone tag. You can set a global timeZone, only one value attribute <fmt: setTimeZone value = "GMT-8"> can be the same as the value of timeZone, but this time is the role of the Global

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.