<fmt:formatNumber>标签详解:
后台:
request.setAttribute("n",123456.123);
request.setAttribute("p",0.12345);
前台:
<fmt:formatNumber value="${n}" type="number" /> //type默认值为number
<fmt:formatNumber value="${n}" pattern="###,###.##" />
<fmt:formatNumber value="${n}" pattern="###,###.0000" />
<fmt:formatNumber value="${n}" groupingUsed="false" /> //groupingUsed属性默认值为true,即,默认分组
<fmt:formatNumber value="${n}" minIntegerDigits="10" /> //minIntegerDigits属性表示整数位最短多少
<fmt:formatNumber value="${n}" type="currency" /> //货币
<fmt:formatNumber value="${p}" type="percent" />
<fmt:formatNumber value="${p}" type="percent" maxFractionDigits="2" minFractionDigits="2" /> //小数位最大,最少多少位
输出结果:
123,456.123
123,456.12
123,456.1230
123456.123
0,000,123,456.123
¥123,456.12
12%
12.34%