惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
H
Heimdal Security Blog
K
Kaspersky official blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Schneier on Security
G
GRAHAM CLULEY
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
C
Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 司徒正美
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
P
Proofpoint News Feed
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
S
Security Affairs
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
N
News | PayPal Newsroom
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU

博客园 - 情走边锋

(摘)设置FCKeditor回车换行方式 JBossESB问题记录 oracle中number类型说明 解决通过createElement创建出来的radio无法选中的问题 asp.net C# 中使用timestamp 编码 GBK 的不可映射字符 解决办法 asp.net中SQL注入的解决办法 - 情走边锋 - 博客园 SQL2005部署报表:用户IUSER_ 授予的权限不足的问题 发现一个网页幻灯制作的东西HTML Slidy AS无法连接,由于目标机积极拒绝,无法连接。127.0.0.1:2382(system) Android中ActivityManager: Error: Activity class {XXX} does not exist的问题 windows上安装postgresql OpenBSD4.0下安装samba 序列化与反序列化 IE6无法正常显示VML Linux下Makefile的automake生成全攻略 随记 C++中的头文件 开始Bro之旅
jstl fmt功能说明
情走边锋 · 2008-11-13 · via 博客园 - 情走边锋

所有标签:

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" /> 分析出时间