To convert numbers put a <f:convertNumber/>
tag in an component.
The following examples show the basic functions of the number converter. The given number is in every example:
By default, grouping is activated and only three digits after the point are shown.
Also the value of type
is 'number'.
<tc:out label="Number"
markup="number" value="\#{conversionController.amount}">
<f:convertNumber/>
</tc:out>
Grouping is deactivated.
<f:convertNumber groupingUsed="false"/>
Only integer values are shown.
<f:convertNumber integerOnly="true"/>
There are at minimum 10 integer digits and 5 digits after the point shown. The given amount is not high enough in both ways.
<f:convertNumber minIntegerDigits="10" minFractionDigits="5"/>
There are maximal 6 integer digits and 2 digits after the point shown. Notice, that the second digit after the point is rounded up.
<f:convertNumber maxIntegerDigits="6" maxFractionDigits="2"/>
The type
attribute can have the value 'number' (default), 'currency' and 'percent'.
If the type is set to 'currency', a code or a symbol must be set. Have a look at the following examples.
The currency code is set to 'EUR'. Also the type must set to 'currency', otherwise the
currencyCode
attribute has no effect.
<f:convertNumber type="currency" currencyCode="EUR"/>
The currency symbol is set to '€'. Also the type must set to 'currency', otherwise the
currencyCode
attribute has no effect.
<f:convertNumber type="currency" currencySymbol="€"/>
The type is set to 'percent'.
<f:convertNumber type="percent"/>