1

double it.error=1 ,int it.d=2

<h:outputText value="#{it.error}">
    <f:convertNumber maxFractionDigits="2" minFractionDigits="2"/>
</h:outputText>

displays 1.00

but

<h:outputText value="#{it.error}">
    <f:convertNumber maxFractionDigits="#{it.d}" minFractionDigits="#{it.d}"/>
</h:outputText>

displays 1

Using tomcat 6.0.29 and mojarra 2.1.4

yodhevauhe
  • 765
  • 3
  • 11
  • 33

1 Answers1

2

That can happen if the <h:outputText> is inside a <h:dataTable> and thus #{it} is not available in the scope when the view is been built (but only when the view is been rendered). The tag handlers like <f:xxx> are only created/evaluated when the view is been built.

There are several ways to workaround this problem, all which are outlined in the following answer: How to set converter properties for each row of a datatable?

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