nightingale2k1 nightingale2k1 - 1 year ago 63
Java Question

formatNumber : how to add 2 decimal digits at the back of numbers?

I am using grails formatNumber and I would like to display my numbers in decimal format.

I would like to display 10 as 10.00
or 0 as 0.00 with 2 decimal digits.

how to do that ?

Answer Source

I believe that you were looking for how to do this with Grails' formatNumber tag

<g:formatNumber number="${10}" format="0.00"/>
<g:formatNumber number="${0}" format="0.00"/>

results in


The formatNumber tag uses DecimalFormat for the format parameter

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download