Search code examples
javajsf-2webconvertersbigdecimal

Format BigDecimal jsf 2.0


I'm new with jsf and i'm trying to format a BigDecimal in my jsf page.

Here is what i did:

<h:outputText value="#{entity.bigDecimalValue}"> 
   <f:convertNumber maxFractionDigits="15" minFractionDigits="15" groupingUsed="false" />
</h:outputText>

this with a really small number it works as expected (example: 0.0000000000001)

but with simple values like number 4 it display 4.000000000000000

¿How can i get rid of the useless zeros?

I just want it shows me the values in a simple way.

Thanks in advance.


Solution

  • minFractionDigits="15"

    If you don't want at least 15 fraction digits, don't specify a minimum of 15 fraction digits.