jstl fmt功能说明
转载自:https://www.geek-share.com/detail/2437572020.html,仅供学习
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 函数大全
主要功能格式化
日期格式(2008年5月5日22点00分23秒)
<fmt:formatDate value="<%=new Date() %>" pattern="yyyy年MM月dd日HH点mm分ss秒" />
保留两位小数
<fmt:formatNumber value="123.123456789" pattern="0.00"/>
格式数字(45,678.234)
<fmt:formatNumber type="number" value="45678.2345" />
格式百分比(23%)
<fmt:formatNumber type="percent" value="0.2345" />
其他
<fmt:bundle>:资源绑定。除了以前提到过的在web.xml中声明以外,还可以利用此标签。
例<fmt:bundle basename="message"></fmt:bundle>
<fmt:setLocale>:设置locale,主要是用于这种情况,一个中国人在国外,locale是en_US,但想用中文显示。
例:<fmt:setLocal value="zh_CN"/>
<fmt:message>:输出properties文件中的指定内容。
例<fmt:message key="user"/>
<fmt:formatNumber type="number">格式化普通数字
<fmt:formatNumber type="percent">格式化百分比
三种数字类型参数:currency,number,percent
<fmt:parseNumber var="i" type="number" value="45678.2345" />
<c:out value="${i}" escapeXml="false" /> 分析出数字
<fmt:requestEncoding value="GB18030"/> 格式化文本编码
<fmt:formatDate value="${date}" type="both" timeStyle="long" dateStyle="long" />
type="both" 输入日期也同时输出具体时间
timeStyle="long" 时间以“长”格式输出 差别:下午02时06分59秒 与 14:06:59
dateStyle="long" 日期以“长”格式输出 差别:2006年9月7日 与 2006-9-7
四种长短参数:long,short,medium,full
<fmt:timeZone value="${timezone}"/> 时区偏移,与上面可配合使用:
<fmt:formatDate value="${d}" timeZone="${zn}" type="both" />
<fmt:parseDate var="i" type="date" value="2006-12-11" />
<c:out value="${i}" escapeXml="false" /> 分析出时间
- jstl fmt功能说明
- jstl fmt功能说明
- jstl fmt功能说明
- jstl fmt标签的关于国际化和取资源文件的说明
- JSTL 中 fmt 的说明
- GPIO的上拉下拉功能说明
- 流程说明:实现一组功能的步骤
- jstl中的<fmt:formatNumber>标签
- IE8 引入跨站数据获取功能说明
- el表达式保留两位小数、使用jstl <fmt:formatNumber>标签保留两位小数
- BPM开发平台关于流程加签功能说明|java开发平台|.net开发平台
- 百度编辑器ueditor的toolbars的各个元素代表的功能说明
- 开源 免费 java CMS - FreeCMS-功能说明-模板管理
- RA-hero-recovery-v1.6.2 各项功能使用说明
- 服务端架构设计及功能说明 推荐
- JSTL fmt:formatNumber日期、 数字、货币格式化
- CCBPM关于工作流引擎授权功能说明
- Kubernetes部署(一):架构及功能说明
- libDBConnector全能数据库连接器程序库架构及功能说明
- 开源 免费 java CMS - FreeCMS-功能说明-单位管理