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,008
  • 7
  • 44
  • 69

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,040,783
  • 362
  • 3,548
  • 3,513