<af:convertNumber>

af:convertNumber convertNumber convert number

type: oracle.adf.rich.Number

This is an extension of the standard JSF javax.faces.convert.NumberConverter The converter provides all the standard functionality of the default NumberConverter and is strict while converting to object.

JSF javax.faces.convert.NumberConverter will convert values like 22.22.2 or 22ABC to valid Number 22.22 and 22 respectively. Here it would result in a conversion failure and would throw a ConverterException.

If number grouping separator, decimal separator is configured in trinidad-config.xml file, it will be used during call to getAsObject() and getAsString() for parsing and formatting. If it has not been set, number grouping separator, decimal separator is defaulted based on the locale.

If currencyCode is set on the converter then it will be used. Else uses the currencyCode set in trinidad-config.xml file. If it is not set in the configuration file then it is defaulted based on the locale.

Since ADF Faces is compatible with JDK 1.4 and higher versions, the currencyCode gets preference over currencySymbol. See JSF's javax.faces.convert.NumberConverter for the way in which currencyCode and currencySymbol gets preference for different version of JDK.

This converter is automatically registered under the standard converter ID, and therefore will be used when the <f:convertNumber> tag is used.

This converter also runs on the client (implements org.apache.myfaces.trinidad.convert.ClientConverter). One exception: If the pattern attribute is specified, the converter will run on the server.

For more information see javadoc for org.apache.myfaces.trinidad.convert.NumberConverter

Attributes

Name Type Supports EL? Description
currencyCode String Yes The ISO 4217 currency code, applied only when formatting currencies. Currency code can also be set for the entire application in trinidad-config.xml file. If currency code is not set on the converter, and if set on trinidad-config.xml configuration file it will be used by calling AdfFacesContext().getCurrenctInstance().getCurrencyCode(). This currency code will be used during call to getAsString() for formatting, provided type is set to 'currency'.
currencySymbol String Yes Currency symbol, is applied only when formatting currencies (i.e. type is set to 'currency'). If currency code is set then symbol will be ignored.
disabled boolean Yes Default Value: false

Whether the converter should be disabled, default to false.
groupingUsed boolean Yes Default Value: true

Flag specifying whether formatted output will contain grouping separators. Default value is true.
hintPattern String Yes

Custom hint message to be used, instead of the default one to give a hint on the desired pattern.

Parameters:

  • {0} the pattern the converter is expecting
integerOnly boolean Yes Default Value: false

Flag specifying whether only the integer part of the value will be formatted and parsed. Default value is false.
locale java.util.Locale Yes Locale whose predefined styles for dates and times are used during formatting or parsing. If not specified or if null, the Locale returned by RequestContext.getFormattingLocale() will be used. If that is null, FacesContext.getViewRoot().getLocale() will be used.
maxFractionDigits int Yes Default Value: 3

Maximum number of digits that will be formatted in the fractional portion of the output. The default value of 3 is standard JSF behavior.
maxIntegerDigits int Yes Maximum number of digits that will be formatted in the integer portion of the output.
messageDetailConvertCurrency String Yes

Custom error message to be used, for creating detail part of the FacesMessage, when value cannot be converted to a number, when type is set to 'currency' and pattern is null or not set.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
Please note: Parameter {1} which specifies the value entered by the user, should never be used in the message if the value is secure, like when secret=true on inputText.
messageDetailConvertNumber String Yes

Custom error message to be used, for creating detail part of the FacesMessage, when value cannot be converted to a number, when type is set to 'number' and pattern is null or not set.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
Please note: Parameter {1} which specifies the value entered by the user, should never be used in the message if the value is secure, like when secret=true on inputText.
messageDetailConvertPattern String Yes

Custom error message to be used, for creating detail part of the FacesMessage message, when value cannot be converted to a number, based on the pattern set.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
  • {2} the specified conversion pattern
Please note: Parameter {1} which specifies the value entered by the user, should never be used in the message if the value is secure, like when secret=true on inputText.
messageDetailConvertPercent String Yes

Custom error message to be used, for creating detail part of the FacesMessage, when value cannot be converted to a number, when type is set to 'percent' and pattern is null or not set.

Parameters:

  • {0} the label that identifies the component
  • {1} value entered by the user
Please note: Parameter {1} which specifies the value entered by the user, should never be used in the message if the value is secure, like when secret=true on inputText.
minFractionDigits int Yes Minimum number of digits that will be formatted in the fractional portion of the output.
minIntegerDigits int Yes Minimum number of digits that will be formatted in the integer portion of the output.
pattern String Yes Custom formatting pattern which determines how the number string should be formatted and parsed. Valid values are those supported by java.text.DecimalFormat. If specified, the converter will be run on the server, as this attribute is not supported on the client.
type String Yes Default Value: number

Specifies how the number string will be formatted and parsed. Valid values are "number", "currency", and "percent". Default value is "number".