1

I have this primefaces inputText component that links to a double value in my backing bean:

<p:inputText id="valueI"
    value="#{productMB.total}">
    <f:convertNumber type="number" maxFractionDigits="0" />
</p:inputText>

When the total is 0 the inputText shows a zero. I need to show an empty value because a zero is visually ugly

How can I do that?

John Alexander Betts
  • 4,718
  • 8
  • 47
  • 72

1 Answers1

4

Use Double instead of double so that it defaults to null instead of 0.0. Primitives can't be represented as null (and therefore also not render as empty).

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555