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

推荐订阅源

V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
V
V2EX
B
Blog RSS Feed
有赞技术团队
有赞技术团队
博客园 - Franky
美团技术团队
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
云风的 BLOG
云风的 BLOG
L
LangChain Blog
GbyAI
GbyAI
The Cloudflare Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Stack Overflow Blog
Stack Overflow Blog
博客园 - 【当耐特】
The Register - Security
The Register - Security
大猫的无限游戏
大猫的无限游戏
D
Docker
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
N
Netflix TechBlog - Medium
博客园_首页
A
About on SuperTechFans
J
Java Code Geeks
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MongoDB | Blog
MongoDB | Blog
Recent Announcements
Recent Announcements
G
Google Developers Blog
小众软件
小众软件
博客园 - 叶小钗
WordPress大学
WordPress大学
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
F
Full Disclosure
Jina AI
Jina AI
H
Help Net Security

博客园 - 情走边锋

(摘)设置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" /> 分析出时间