我想在jsp页面中格式化一些数字。
首先,我在porperties中定义了一些资源
format.number.with2Decimal={0,number,#0.00}
.
Question1:
我想知道“#”和“0”是什么意思?
0.00,#0.00,##.00,###0.00
谁能告诉我他们之间的区别呢?谢谢!
Question2:
如果我在操作BigDecimal number1中定义了一个BigDecimal类型;
那么我的页面应该使用一种格式来显示这个值,
1.if number1=null then show -NIL-
2.if number1=0 then show -NIL-
3.if number1>0 then show 1.00,3434.98 .....
请忽略number<0
Question3:
将number1更改为字符串,
1.if number1=null or empty or blank then show -NIL-
2.if number1=Hello then show Hello ....
你能帮我一下吗?
发布于 2013-12-11 06:28:43
给你:
<s:property value="getText('{0,number,#,##0.00}',{profit})"/>这就是我在我的项目中格式化数字的方式。您可以将它与<s:if>一起使用以达到您所需的目的。
https://stackoverflow.com/questions/20511845
复制相似问题