1
我有BigDecimal的领域豆定义为格式在春季3
@Digits(integer=3, fraction=2)
@NumberFormat(style=Style.NUMBER)
private BigDecimal vatRate = new BigDecimal(0.0f);
格式化行之有效的内部形式(我用<mvc:annotation-driven />
),但试图用值来填充表作为
<td> ${c.vatRate} %</td>
时
我收到的价格为12.30000000000000000000000000000000 %
或0E-32 %
。
我曾尝试使用也<fmt:formatNumber/>
但我得到了一个异常
In <formatNumber>, value attribute can not be parsed into java.lang.Number: " 0E-32"
现在谈到我只能用特殊字符串吸气解决方案,我的豆,将提供格式化的值。但是,有没有在表示层的任何“好”的解决方案(最好纪念@digits注释?)
您是否尝试过用裂变材料条约“模式”属性:formatNumber(http://www.tutorialspoint.com/jsp/jstl_format_formatnumber_tag.htm) –
我已经尝试过' '但是由于错误提示,解析值存在问题 –
sodik