jstl中的<fmt:formatNumber>标签

 
设置显示时间戳
<%
    request.setAttribute("currentTimeStamp",Calendar.getInstance().getTime());
%>

显示:2009-11 
<fmt:formatDate pattern="yyyy-MM" value="${currentTimeStamp}"/> <br/>  
显示:2009-11-30 23:47:06 
<fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${currentTimeStamp}"/> <br/>
 显示:$12.00
<fmt:formatNumber value="12" type="currency" pattern="$.00"/>  <br/>
显示:$12.0
<fmt:formatNumber value="12" type="currency" pattern="$.#"/> <br/> 
¥12.0 
<fmt:formatNumber value="12" type="currency" pattern="¥.00"/> <br/>
12.00元
<fmt:formatNumber value="12" type="currency" pattern="#0.00元"/> <br/>
¥12.00 
<fmt:formatNumber value="12" type="currency"/>  (那个货币的符号和当前web服务器的 local 设定有关)<br/>

123456.79
<fmt:formatNumber value="123456.7891" pattern="#0.00"/>  <br/>
123,456.79
<fmt:formatNumber value="123456.7891" pattern="#,#00.00"/> <br/>
 .79 
<fmt:formatNumber value="0.7891" pattern="#.00"/>  <br/>
12.34%
<fmt:formatNumber value="0.1234" type="percent" pattern="#0.00%"/><br/>
1,200%
<fmt:formatNumber value="12" type="percent"  /><br/>
1200.00%
<fmt:formatNumber value="12" type="percent" pattern="#0.00%"/><br/>
------------------------------------------------------------------------------
java格式化输出:
DecimalFormat df = new DecimalFormat("格式");
String fmt =df.format(double);
符号                  意义
0                     一个数位
#                     一个数位,前导零和追尾零不显示
.                      小数点分割位置
,                     组分隔符的位置
-                      负数前缀
%                    用100乘,并显示百分号
其他任何符号    在输出字符串中包括指定符号

jstl格式化数字的更多相关文章

  1. JSP页面格式化数字或时间 基于jstl的

    jsp页面格式化数字或时间 转载自: http://blog.csdn.net/hakunamatata2008/archive/2011/01/21/6156203.aspx Tags fmt:re ...

  2. 在jsp页面中实现格式化数字,百分比,货币

    当时的要求是在jsp页面中计算百分比 实现方法 1.引入Jstl的fmt指令 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" ...

  3. jstl 格式化

    一:JSTL格式化标签又称为I18N标签库,主要用来编写国际化的WEB应用,使用此功能可以对一个特定的语言请求做出合适的处理.例如:中国内地用户将显示简体中文,台湾地区则显示繁体中文,使用I18N格式 ...

  4. JSTL格式化标签库

    导入标签库需要使用taglib指令! <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/forma ...

  5. java基础之——DecimalFormat格式化数字

    DecimalFormat可以用来格式化数字,例如用来设定保留多少位小数.设定数字分隔符等. 说方法之前,先介绍一下其常用的几个模式占位符: 0 一个数字# 一个数字,不包括 0. 小数的分隔符的占位 ...

  6. js格式化数字和金额

    格式化数字,格式化金额: function number_format(number, decimals, dec_point, thousands_sep) { /* * 参数说明: * numbe ...

  7. Smarty格式化数字为INT数

    <? require("setup.php"); define('PAGETITLE','pagtitle'); function insert_top($lid,$sid) ...

  8. php number_format()保留小数点后几位有效数的函数 千位分组来格式化数字(转)

    PHP保留小数点后2位的函数number_format number_format(带小数点的书,小数点后保留的位数) number_format(8.3486,2);  //取得小数点后2位有效数/ ...

  9. php的格式化数字函数

    php格式化数字:位数不足前面加0补足 php格式化数字:位数不足前面加0补足 感谢:http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/12 ...

随机推荐

  1. 由于xrdp、gnome和unity之间的兼容性问题,在

    由于xrdp.gnome和unity之间的兼容性问题,在Ubuntu 14.04版本中仍然无法使用xrdp登陆gnome或unity的远程桌面,现象是登录后只有黑白点为背景,无图标也无法操作.与13. ...

  2. 用正则从html代码中提取图片路径

    $str = '<div align="center"> <img src="http://www.99tyg.com/public/images/e8 ...

  3. C++宽窄字符串转换

    首先,贴出我给出的解决方案: http://files.cnblogs.com/xuejianhui/utils.rar   再则,贴出网上最常见的例子: #include <string> ...

  4. Discovering the Computer Science Behind Postgres Indexes

    This is the last in a series of Postgres posts that Pat Shaughnessy wrote based on his presentation ...

  5. Nginx php-fpm php mysql

    rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm ...

  6. Openstack Neutron OVS ARP Responder

    ARP – Why do we need it? In any environment, be it the physical data-center, your home, or a virtual ...

  7. MapReduce单表关联学习~

    首先考虑表的自连接,其次是列的设置,最后是结果的整理. 文件内容: import org.apache.hadoop.conf.Configuration; import org.apache.had ...

  8. [Tex学习笔记]积分平均

    $\def\avint{\mathop{\mathchoice{\,\rlap{-}\!\!\int} {\rlap{\raise.15em{\scriptstyle -}}\kern-.2em\in ...

  9. java gui 下拉框中项删除按钮

    http://www.cnblogs.com/kangls/archive/2013/03/21/2972943.html http://m.blog.csdn.net/blog/ycb1689/74 ...

  10. php二维数组排序方法(转自http://www.3lian.com/edu/2013/12-26/118882.html)

    一维数组排序可以使用asort.ksort等一些方法进程排序,相对来说比较简单.二维数组的排序怎么实现呢?使用array_multisort和usort可以实现 例如像下面的数组:    代码如下: ...