posts - 325,  comments - 25,  trackbacks - 0
          I18N庫主要完成:
              1.web應用程序的國際化
              2.消息、日期的格式化
          1.<fmt:formatNumber>:在jsp頁面中格式化數字
                  <fmt:formatNumber 
                          var="存放結果的變量"
                          value="將被格式化的數字"
                          scope="范圍"
                          type="number/currency/percent"http://數字,貨幣,百分比
                          currencyCode="cny/usd" //cny:人民幣 usd:美元
                          currencySymbol="羊/$" //標準貨幣符號
                          groupingUsed="true/false" //是否將數字進行區隔 如:123,456,00
                          maxFractionDigits="最多小數位數"
                          maxIntegerDigits="最多整數位數"
                          minFractionDigits="最少小數位數"
                          minIntegerDigits="最少整數位數"
                          pattern="格式化數字用的樣式" //如:####.##
              />
                  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頁面中實現將字符串形式的數字、貨幣、百分比轉換成數字
                  <fmt:parseNumber
                          var="存放轉換結果的變量"
                          value="將轉換的值"
                          scope="范圍"
                          type="number/currency/percent"
                          parseLocale="zh_CN,en"http://語言地區代碼
                          integerOnly="true/false"是否只顯示整數部分
                          pattern="$$$$.$$"http://格式化數字所用的樣式
                  />
                  eg:
                   <fmt:parseNumber var="result" value="yang 6789.36" type="currency"/>   輸出結果為:6789.36
                   <fmt:parseNumber var="result" value="78.90%" type="percent"/>             輸出結果為:0.789
          3.<fmt:formatDate>:在jsp頁面中實現格式化日期和時間
                  <fmt:formatDate
                      var="存放格式化結果的變量"
                      value="將被格式化的日期或時間"
                      scope="page/request/session/application"
                      type="time/date/both" //time:時間 date:日期 both:時間和日期
                      dateStyle="default/short/medium/logn/full"  //日期的顯示方式
                      timeStyle="default/short/medium/logn/full"  //時間的顯示方式            
                      timeZone="CST" 設置時區:CST:中部標準時間
                      pattern="yyyy 年MM 月dd日 hh:mm:ss"
                  </fmt:fomatDate>
          4.<fmt:parseDate>:將字符串形式的時間和日期轉換成日期時間類型
                 <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" //語言地區碼
                                        variant="瀏覽器類型" // Win,Mac
                                         scope="request等"/>
          6.<fmt:setBundle>:設置默認消息資源
                 <fmt:setBundle basename="basename"http:// 資源名稱,如:MessageResource
                                         var="存放資源文件名稱的變量"
                                         scope="request"/>
              eg:
                  <fmt:setLocale value="zh_CN"/>
                  <fmt:setBundle basename="MessageResource"/>//假如有一個MessageResource.properties信息資源文件
          7.<fmt:message>:在指定的消息資源文件中按關鍵字取出相應的消息內容
              <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 長春語林科技 閱讀(821) 評論(0)  編輯  收藏 所屬分類: jstl

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2008年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

           

          長春語林科技歡迎您!

          常用鏈接

          留言簿(6)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          相冊

          收藏夾

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 泰安市| 灌南县| 井冈山市| 天全县| 西峡县| 乌审旗| 岳阳市| 巴中市| 玉树县| 确山县| 中西区| 永新县| 定州市| 漾濞| 大连市| 阜南县| 博野县| 互助| 西充县| 涞源县| 南投县| 孙吴县| 夏河县| 东方市| 东辽县| 黄平县| 庆元县| 波密县| 土默特右旗| 海林市| 涟水县| 南川市| 庆元县| 台山市| 固原市| 禹城市| 安阳县| 万州区| 洱源县| 叙永县| 喜德县|