日期:2014-05-16 浏览次数:20312 次
<h1>测试jstl格式化库</h1> <hr> <li>测试日期的格式化</li><br> today(default):<fmt:formatDate value="${today}"/><br> today(type="date"):<fmt:formatDate value="${today}" type="date"/><br> today(type="time"):<fmt:formatDate value="${today}" type="time"/><br> today(type="both"):<fmt:formatDate value="${today}" type="both"/><br> today(dateStyle="short"):<fmt:formatDate value="${today}" dateStyle="short"/><br> today(dateStyle="medium"):<fmt:formatDate value="${today}" dateStyle="medium"/><br> today(dateStyle="long"):<fmt:formatDate value="${today}" dateStyle="long"/><br> today(dateStyle="full"):<fmt:formatDate value="${today}" dateStyle="full"/><br> today(pattern="yyyy/MM/dd HH:mm:ss"):<fmt:formatDate value="${today}" pattern="yyyy/MM/dd HH:mm:ss"/><br> today(pattern="yyyy/MM/dd HH:mm:ss"):<fmt:formatDate value="${today}" pattern="yyyy/MM/dd HH:mm:ss" var="d"/>${d }<br> today(pattern="yyyy/MM/dd HH:mm"):<fmt:formatDate value="${today}" pattern="yyyy/MM/dd HH:mm" /><br> <p> <li>测试数字的格式化</li><br> n(default):<fmt:formatNumber value="${n}"/><br> n(pattern="###,###.##"):<fmt:formatNumber value="${n}" pattern="###,###.##"/><br> n(pattern="###,###.0000"):<fmt:formatNumber value="${n}" pattern="###,###.0000"/><br> n(groupingUsed="false"):<fmt:formatNumber value="${n}" groupingUsed="false"/><br> n(minIntegerDigits="10"):<fmt:formatNumber value="${n}" minIntegerDigits="10"/><br> n(type="currency"):<fmt:formatNumber value="${n}" type="currency"/><br> n(type="currency"):<fmt:formatNumber value="${n}" type="currency" currencySymbol="$"/><br> n(type="percent"):<fmt:formatNumber value="${p}" type="percent" maxFractionDigits="2" minFractionDigits="2"/><br>
request.setAttribute("today", new Date()); request.setAttribute("n", 123456.123); request.setAttribute("p", 0.12345); return mapping.findForward("success");
测试jstl格式化库 -------------------------------------------- ?测试日期的格式化 today(default):2012-5-29 today(type="date"):2012-5-29 today(type="time"):14:43:39 today(type="both"):2012-5-29 14:43:39 today(dateStyle="short"):12-5-29 today(dateStyle="medium"):2012-5-29 today(dateStyle="long"):2012年5月29日 today(dateStyle="full"):2012年5月29日 星期二 today(pattern="yyyy/MM/dd HH:mm:ss"):2012/05/29 14:43:39 today(pattern="yyyy/MM/dd HH:mm:ss"):2012/05/29 14:43:39 today(pattern="yyyy/MM/dd HH:mm"):2012/05/29 14:43 ?测试数字的格式化 n(default):123,456.123 n(pattern="###,###.##"):123,456.12 n(pattern="###,###.0000"):123,456.1230 n(groupingUsed="false"):123456.123 n(minIntegerDigits="10"):0,000,123,456.123 n(type="currency"):¥123,456.12 n(type="currency"):$123,456.12 n(type="percent"):12.34%