posts - 325,  comments - 25,  trackbacks - 0
          I18N庫(kù)主要完成:
              1.web應(yīng)用程序的國(guó)際化
              2.消息、日期的格式化
          1.<fmt:formatNumber>:在jsp頁(yè)面中格式化數(shù)字
                  <fmt:formatNumber 
                          var="存放結(jié)果的變量"
                          value="將被格式化的數(shù)字"
                          scope="范圍"
                          type="number/currency/percent"http://數(shù)字,貨幣,百分比
                          currencyCode="cny/usd" //cny:人民幣 usd:美元
                          currencySymbol="羊/$" //標(biāo)準(zhǔn)貨幣符號(hào)
                          groupingUsed="true/false" //是否將數(shù)字進(jìn)行區(qū)隔 如:123,456,00
                          maxFractionDigits="最多小數(shù)位數(shù)"
                          maxIntegerDigits="最多整數(shù)位數(shù)"
                          minFractionDigits="最少小數(shù)位數(shù)"
                          minIntegerDigits="最少整數(shù)位數(shù)"
                          pattern="格式化數(shù)字用的樣式" //如:####.##
              />
                  eg:
                      <fmt:formatNumber var="result" value="6789.3581" type="currency" maxFractionDigits="2" groupingUsed="true"/>
                      <c:out value="${result}"/> :6,789.36
          2.<fmt:parseNumber>:在jsp頁(yè)面中實(shí)現(xiàn)將字符串形式的數(shù)字、貨幣、百分比轉(zhuǎn)換成數(shù)字
                  <fmt:parseNumber
                          var="存放轉(zhuǎn)換結(jié)果的變量"
                          value="將轉(zhuǎn)換的值"
                          scope="范圍"
                          type="number/currency/percent"
                          parseLocale="zh_CN,en"http://語(yǔ)言地區(qū)代碼
                          integerOnly="true/false"是否只顯示整數(shù)部分
                          pattern="$$$$.$$"http://格式化數(shù)字所用的樣式
                  />
                  eg:
                   <fmt:parseNumber var="result" value="yang 6789.36" type="currency"/>   輸出結(jié)果為:6789.36
                   <fmt:parseNumber var="result" value="78.90%" type="percent"/>             輸出結(jié)果為:0.789
          3.<fmt:formatDate>:在jsp頁(yè)面中實(shí)現(xiàn)格式化日期和時(shí)間
                  <fmt:formatDate
                      var="存放格式化結(jié)果的變量"
                      value="將被格式化的日期或時(shí)間"
                      scope="page/request/session/application"
                      type="time/date/both" //time:時(shí)間 date:日期 both:時(shí)間和日期
                      dateStyle="default/short/medium/logn/full"  //日期的顯示方式
                      timeStyle="default/short/medium/logn/full"  //時(shí)間的顯示方式            
                      timeZone="CST" 設(shè)置時(shí)區(qū):CST:中部標(biāo)準(zhǔn)時(shí)間
                      pattern="yyyy 年MM 月dd日 hh:mm:ss"
                  </fmt:fomatDate>
          4.<fmt:parseDate>:將字符串形式的時(shí)間和日期轉(zhuǎn)換成日期時(shí)間類型
                 <fmt:parseDate
                          var="varName"
                          value="value"
                          scope="request"
                          type="time/date/both"
                          dateStyle="default/short/medium/long/full"
                          timeStyle="default/short/medium/long/full"
                          timeZone="timeZone"
                          pattern="pattern"/>
                  eg:
                  <c:set var="now" value="2008-05-26 11:04:00"/>
                  <fmt:parseDate var="result" value="{now}" type="both"/>
                  <c:out value="${result}"/>   
          5.<fmt:setLocale>
                <fmt:setLocale value="zh_CN,en" //語(yǔ)言地區(qū)碼
                                        variant="瀏覽器類型" // Win,Mac
                                         scope="request等"/>
          6.<fmt:setBundle>:設(shè)置默認(rèn)消息資源
                 <fmt:setBundle basename="basename"http:// 資源名稱,如:MessageResource
                                         var="存放資源文件名稱的變量"
                                         scope="request"/>
              eg:
                  <fmt:setLocale value="zh_CN"/>
                  <fmt:setBundle basename="MessageResource"/>//假如有一個(gè)MessageResource.properties信息資源文件
          7.<fmt:message>:在指定的消息資源文件中按關(guān)鍵字取出相應(yīng)的消息內(nèi)容
              <fmt:message key="messageKey"/>
               eg:
                      <jsp:useBean id="now" class="java.util.Date"/>
                      <fmt:formatDate value="${now} var="result"/>
                      <fmt:setLocale value="zh_CN"/>
                       <fmt:setBundle basename="MessageResource"/>
                       <fmt:message key="hello">
                              <fmt:param value="lhb"/>
                      </fmt:message>
                      <fmt:message key="today">
                              <fmt:param value="${result}"/>
                      </fmt:message>
          posted on 2008-05-26 11:21 長(zhǎng)春語(yǔ)林科技 閱讀(823) 評(píng)論(0)  編輯  收藏 所屬分類: jstl

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


          網(wǎng)站導(dǎo)航:
           
          <2008年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

           

          長(zhǎng)春語(yǔ)林科技?xì)g迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊(cè)

          收藏夾

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 广河县| 鄄城县| 淮南市| 合作市| 石首市| 奉新县| 卢龙县| 南城县| 德钦县| 杂多县| 张家口市| 蒙山县| 中江县| 安阳县| 南江县| 南澳县| 遂昌县| 白城市| 缙云县| 台安县| 庆阳市| 同德县| 湖北省| 柘荣县| 青龙| 富蕴县| 县级市| 玛纳斯县| 加查县| 平阳县| 新丰县| 深泽县| 凤台县| 重庆市| 柯坪县| 柳河县| 广昌县| 石台县| 石门县| 长垣县| 周宁县|