空間站

          北極心空

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            15 Posts :: 393 Stories :: 160 Comments :: 0 Trackbacks
           1 JSP Standard Tag Libraries   
           2 Formatting and Internationalization   
           3 Two form input parameters, 'date' and 'isoDate', are URL-encoded in the link leading to this page. 'isoDate' is formatted according to the ISO8601 standard.   
           4 Formatting of numbers and dates is based on the browser's locale setting. Formatting will change if you switch the default language setting from English to French or German, for example. (The browser needs to be restarted, too.)   
           5   
           6 Library import and parameter capturing:   
           7   
           8 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>  
           9 <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  
          10   
          11 <fmt:parseDate value="${param.date}" var="date" pattern="yyyy/MM/dd:HH:mm:ss>  
          12 <fmt:parseDate value="${param.isoDate}" var="isoDate" pattern="yyyyMMdd'T'HHmmss">  
          13   
          14 The input parameters must match the patterns, or the JSP will thrown an exception. This page does no error handling.   
          15   
          16 Input parameters:   
          17 Date:    2004/04/01:13:30:00   Java format: Thu Apr 01 13:30:00 CST 2004   
          18 isoDate: 20040531T235959       Java format: Mon May 31 23:59:59 CDT 2004   
          19   
          20 Dates   
          21 Tag Output   
          22 Attribute: value; required. Tag has no body.   
          23 <fmt:formatDate value="${date}" type="both"/>  
          24   
          25  2004-4-1 13:30:00     
          26 <fmt:formatDate value="${isoDate}" type="both"/>  
          27   
          28  2004-5-31 23:59:59     
          29 Attribute: type; optional. Indicates what to print: date, time, or both.   
          30 <fmt:formatDate value="${date}" type="date"/>  
          31   
          32  2004-4-1     
          33 <fmt:formatDate value="${isoDate}" type="time"/>  
          34   
          35  23:59:59     
          36 Attribute: dateStyle; optional. Varies the date format.   
          37 <fmt:formatDate value="${isoDate}" type="date" dateStyle="default"/>  
          38   
          39  2004-5-31     
          40 <fmt:formatDate value="${isoDate}" type="date" dateStyle="short"/>  
          41   
          42  04-5-31     
          43 <fmt:formatDate value="${isoDate}" type="date" dateStyle="medium"/>  
          44   
          45  2004-5-31     
          46 <fmt:formatDate value="${isoDate}" type="date" dateStyle="long"/>  
          47   
          48  2004年5月31日     
          49 <fmt:formatDate value="${isoDate}" type="date" dateStyle="full"/>  
          50   
          51  2004年5月31日 星期一     
          52 Attribute: timeStyle; optional. Varies the time format.   
          53 <fmt:formatDate value="${isoDate}" type="time" timeStyle="default"/>  
          54   
          55  23:59:59     
          56 <fmt:formatDate value="${isoDate}" type="time" timeStyle="short"/>  
          57   
          58  下午11:59     
          59 <fmt:formatDate value="${isoDate}" type="time" timeStyle="medium"/>  
          60   
          61  23:59:59     
          62 <fmt:formatDate value="${isoDate}" type="time" timeStyle="long"/>  
          63   
          64  下午11時(shí)59分59秒     
          65 <fmt:formatDate value="${isoDate}" type="time" timeStyle="full"/>  
          66   
          67  下午11時(shí)59分59秒 CDT     
          68 Attribute: pattern; optional. Inidcates date/time custom patterns.   
          69 <fmt:formatDate value="${date}" type="both" pattern="EEEE, MMMM d, yyyy HH:mm:ss Z"/>  
          70   
          71  星期四, 四月 1, 2004 13:30:00 -0600     
          72 <fmt:formatDate value="${isoDate}" type="both" pattern="d MMM yy, h:m:s a zzzz/>  
          73   
          74  31 五月 04, 11:59:59 下午 中央夏令時(shí)  
          75 
          posted on 2008-08-12 15:50 蘆葦 閱讀(828) 評(píng)論(0)  編輯  收藏 所屬分類: JAVAHTML & Script
          主站蜘蛛池模板: 元氏县| 新余市| 类乌齐县| 嘉定区| 本溪市| 五寨县| 阳山县| 抚远县| 临江市| 新邵县| 长顺县| 凯里市| 贺兰县| 乌鲁木齐县| 普宁市| 凤凰县| 沅江市| 当阳市| 南靖县| 红河县| 南澳县| 永吉县| 林口县| 阜新| 南木林县| 喀什市| 上思县| 永年县| 东兰县| 汾西县| 内黄县| 贺兰县| 嘉祥县| 麻江县| 军事| 准格尔旗| 璧山县| 夹江县| 牟定县| 康马县| 黄大仙区|