Search code examples
javajsfelbigdecimalnumber-formatting

Format a BigDecimal so that 100 shows up as 100 instead of 1.0E+2


I am outputing a BigDecimal using EL expression as follows: #{beanActions.overallScore}.

But when the value is 100, then it appears as 1.0E+2.

How can I display it as 100 without changing the type to String?


Solution

  • The following works in my environment (Mojarra 2.1.3 with EL 2.2):

    <h:outputText value="#{beanActions.overallScore}">
        <f:convertNumber integerOnly="true"/>
    </h:outputText>