DaveB
DaveB

Reputation: 3083

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?

Upvotes: 0

Views: 409

Answers (2)

Matt Handy
Matt Handy

Reputation: 30025

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>

Upvotes: 3

d1e
d1e

Reputation: 6452

Try looking through JSF NumberConverter.

Upvotes: 0

Related Questions