I’m trying to get the 2-digit fraction part only using <f:convertNumber>. E.g. 103.99 must result in .99.
<h:outputText value="#{myBean.totalFare}">
<f:convertNumber pattern="#,##0.00" />
</h:outputText>
This does not work. I also tried to use the patterns ,##.00 and ,##, but failed.
How can I achieve this?
That’s not possible with
<f:convertNumber>. It’s not intented to manipulate numbers (read: performing any math on it), but it’s intented to format/convert it.You should first trim off the integer part by a modulus of 1.
Then you can use the pattern of
.##in order to show two fractions only: