隨筆 - 22  文章 - 3  trackbacks - 0
          <2009年5月>
          262728293012
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          所有標(biāo)簽:

          Tags  
          fmt:requestEncoding
          fmt:setLocale
          fmt:timeZone
          fmt:setTimeZone
          fmt:bundle
          fmt:setBundle
          fmt:message
          fmt:param
          fmt:formatNumber
          fmt:parseNumber
          fmt:formatDate
          fmt:parseDate 

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

          jstl fmt 函數(shù)大全

          主要功能格式化

          日期格式(2008年5月5日22點(diǎn)00分23秒)

          <fmt:formatDate value="<%=new Date() %>" pattern="yyyy年MM月dd日HH點(diǎn)mm分ss秒" />

          保留兩位小數(shù)

          <fmt:formatNumber value="123.123456789" pattern="0.00"/>

          格式數(shù)字(45,678.234)

          <fmt:formatNumber type="number" value="45678.2345" />

          格式百分比(23%)
          <fmt:formatNumber type="percent" value="0.2345" />

           

          其他

          <fmt:bundle>:資源綁定。除了以前提到過的在web.xml中聲明以外,還可以利用此標(biāo)簽。

          例<fmt:bundle basename="message"></fmt:bundle>

          <fmt:setLocale>:設(shè)置locale,主要是用于這種情況,一個(gè)中國(guó)人在國(guó)外,locale是en_US,但想用中文顯示。

          例:<fmt:setLocal value="zh_CN"/>

          <fmt:message>:輸出properties文件中的指定內(nèi)容。

          例<fmt:message key="user"/>

          <fmt:formatNumber type="number">格式化普通數(shù)字
          <fmt:formatNumber type="percent">格式化百分比

          三種數(shù)字類型參數(shù):currency,number,percent

          <fmt:parseNumber var="i" type="number" value="45678.2345" />
          <c:out value="${i}" escapeXml="false" /> 分析出數(shù)字

          <fmt:requestEncoding value="GB18030"/> 格式化文本編碼

          <fmt:formatDate value="${date}" type="both" timeStyle="long" dateStyle="long" />
          type="both" 輸入日期也同時(shí)輸出具體時(shí)間
          timeStyle="long" 時(shí)間以“長(zhǎng)”格式輸出 差別:下午02時(shí)06分59秒 與 14:06:59
          dateStyle="long" 日期以“長(zhǎng)”格式輸出 差別:2006年9月7日 與 2006-9-7

          四種長(zhǎng)短參數(shù):long,short,medium,full

          <fmt:timeZone value="${timezone}"/> 時(shí)區(qū)偏移,與上面可配合使用:
          <fmt:formatDate value="$wmqeeuq" timeZone="${zn}" type="both" />

          <fmt:parseDate var="i" type="date" value="2006-12-11" />
          <c:out value="${i}" escapeXml="false" /> 分析出時(shí)間

          posted on 2009-05-14 01:03 圣克爾·光 閱讀(1649) 評(píng)論(0)  編輯  收藏 所屬分類: jstl

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 新闻| 洛南县| 屏边| 金阳县| 景宁| 白山市| 阜南县| 永嘉县| 洪洞县| 延川县| 南开区| 大英县| 潮安县| 阳朔县| 涟水县| 定襄县| 上思县| 余姚市| 五大连池市| 临武县| 桃园市| 白玉县| 黑龙江省| 红原县| 桓仁| 石台县| 仁化县| 寻甸| 和顺县| 武陟县| 商丘市| 渝中区| 涪陵区| 南部县| 陆河县| 全南县| 长兴县| 海淀区| 佛坪县| 西充县| 德兴市|