Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
Documentation
Search
  1. Introduction
  2. Getting Started
  3. Developing Web Sites
  4. Using Components
  5. Internationalization
  6. Code View Support
  7. Design View Support
  8. Keyboard Shortcuts
  9. Tag Object Toolbars
  10. JSF Server Behaviors
  11. Property Inspectors
  12. JSF Tag Reference
JSF Core Tag Library
  f:actionListener
  f:ajax
  f:attribute
  f:convertDateTime
Selected f:convertNumber
  f:converter
  f:event
  f:facet
  f:loadBundle
  f:metadata
  f:param
  f:phaseListener
  f:selectItem
  f:selectItems
  f:setPropertyActionListener
  f:subview
  f:validateBean
  f:validateDoubleRange
  f:validateLength
  f:validateLongRange
  f:validateRegex
  f:validateRequired
  f:validator
  f:valueChangeListener
  f:verbatim
  f:view
  f:viewParam
If you like this documentation, please take a look at my book:

12. JSF Core Tag Reference

Documentation > JSF > JSF Tag Reference > JSF Core Tag Library > f:convertNumber

f:convertNumber

The ConvertNumber tag registers a NumberConverter instance on the component associated with the enclosing tag. A NumberConverter is a JSF converter class that handles the conversion of strings to numbers and vice versa. The convertNumber tag provides a range of options for customizing the appearance of numeric data. It is useful for converting floating-point and integer values from your domain model into a format that is appropriate for your users. The body content of this tag must be empty.

JSF Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html">
<body>
<h:outputText id="balance" value="#{accountBean.balance}">
	<f:convertNumber currencySymbol="$" groupingUsed="true" 
	                 maxFractionDigits="2" type="currency" />
</h:outputText>
</body>
</html>
This example was formatted by JSFToolbox for Dreamweaver.

HTML Output

$1,234,567.89

Tag Attributes

binding Expression
 
The value-binding expression linking this component tag to a backing bean property.
currencyCode Enumerated
 
The currencyCode attribute sets the ISO 4217 currency code to be applied when formatting currencies.
  • AED
  • AFA
  • ALL
  • AMD
  • ANG
  • AOA
  • ARS
  • AUD
  • AWG
  • AZM
  • BAM
  • BBD
  • BDT
  • BGN
  • BHD
  • BIF
  • BMD
  • BND
  • BOB
  • BRL
  • BSD
  • BTN
  • BWP
  • BYR
  • BZD
  • CAD
  • CDF
  • CHF
  • CLP
  • CNY
  • COP
  • CRC
  • CSD
  • CUP
  • CVE
  • CYP
  • CZK
  • DJF
  • DKK
  • DOP
  • DZD
  • EEK
  • EGP
  • ERN
  • ETB
  • EUR
  • FJD
  • FKP
  • GBP
  • GEL
  • GGP
  • GHC
  • GIP
  • GMD
  • GNF
  • GTQ
  • GYD
  • HKD
  • HNL
  • HRK
  • HTG
  • HUF
  • IDR
  • ILS
  • IMP
  • INR
  • IQD
  • IRR
  • ISK
  • JEP
  • JMD
  • JOD
  • JPY
  • KES
  • KGS
  • KHR
  • KMF
  • KPW
  • KRW
  • KWD
  • KYD
  • KZT
  • LAK
  • LBP
  • LKR
  • LRD
  • LSL
  • LTL
  • LVL
  • LYD
  • MAD
  • MDL
  • MGA
  • MKD
  • MMK
  • MNT
  • MOP
  • MRO
  • MTL
  • MUR
  • MVR
  • MWK
  • MXN
  • MYR
  • MZM
  • NAD
  • NGN
  • NIO
  • NOK
  • NPR
  • NZD
  • OMR
  • PAB
  • PEN
  • PGK
  • PHP
  • PKR
  • PLN
  • PYG
  • QAR
  • RON
  • RUB
  • RWF
  • SAR
  • SBD
  • SCR
  • SDD
  • SEK
  • SGD
  • SHP
  • SIT
  • SKK
  • SLL
  • SOS
  • SPL
  • SRD
  • STD
  • SVC
  • SYP
  • SZL
  • THB
  • TJS
  • TMM
  • TND
  • TOP
  • TRL
  • TRY
  • TTD
  • TVD
  • TWD
  • TZS
  • UAH
  • UGX
  • USD
  • UYU
  • UZS
  • VEB
  • VND
  • VUV
  • WST
  • XAF
  • XAG
  • XAU
  • XCD
  • XDR
  • XOF
  • XPD
  • XPF
  • XPT
  • YER
  • ZAR
  • ZMK
  • ZWD
currencySymbol Text
 
The currencySymbol attribute sets the currency symbol to be applied when formatting currencies.
for Text
Since JSF 2.0
If present, this attribute refers to the value of one of the exposed attached objects within the composite component inside of which this tag is nested.
groupingUsed Text
 
The groupingUsed attribute sets a flag specifying whether formatted output will contain grouping separators. Valid expressions must evaluate to a boolean value. The default value for this attribute is true.
integerOnly Boolean
 
The integerOnly attribute sets a flag specifying whether only the integer part of the value will be formatted. Valid expressions must evaluate to a boolean value. The default value for this attribute is false.
locale Enumerated
 
The locale attribute sets the language, country, and variant for formatting locale-sensitive data such as numbers and dates. If not specified, the Locale returned by FacesContext. getViewRoot(). getLocale() will be used. Valid expressions must evaluate to a java. util. Locale.
  • ar
  • ar_AE
  • ar_BH
  • ar_DZ
  • ar_EG
  • ar_IQ
  • ar_JO
  • ar_KW
  • ar_LB
  • ar_LY
  • ar_MA
  • ar_OM
  • ar_QA
  • ar_SA
  • ar_SD
  • ar_SY
  • ar_TN
  • ar_YE
  • be
  • be_BY
  • bg
  • bg_BG
  • ca
  • ca_ES
  • cs
  • cs_CZ
  • da
  • da_DK
  • de
  • de_AT
  • de_CH
  • de_DE
  • de_LU
  • el
  • el_GR
  • en
  • en_AU
  • en_CA
  • en_GB
  • en_IE
  • en_IN
  • en_NZ
  • en_US
  • en_ZA
  • es
  • es_AR
  • es_BO
  • es_CL
  • es_CO
  • es_CR
  • es_DO
  • es_EC
  • es_ES
  • es_GT
  • es_HN
  • es_MX
  • es_NI
  • es_PA
  • es_PE
  • es_PR
  • es_PY
  • es_SV
  • es_UY
  • es_VE
  • et
  • et_EE
  • fi
  • fi_FI
  • fr
  • fr_BE
  • fr_CA
  • fr_CH
  • fr_FR
  • fr_LU
  • hi_IN
  • hr
  • hr_HR
  • hu
  • hu_HU
  • is
  • is_IS
  • it
  • it_CH
  • it_IT
  • iw
  • iw_IL
  • ja
  • ja_JP
  • ko
  • ko_KR
  • lt
  • lt_LT
  • lv
  • lv_LV
  • mk
  • mk_MK
  • nl
  • nl_BE
  • nl_NL
  • no
  • no_NO
  • no_NO_NY
  • pl
  • pl_PL
  • pt
  • pt_BR
  • pt_PT
  • ro
  • ro_RO
  • ru
  • ru_RU
  • sk
  • sk_SK
  • sl
  • sl_SI
  • sq
  • sq_AL
  • sv
  • sv_SE
  • th
  • th_TH
  • th_TH_TH
  • tr
  • tr_TR
  • uk
  • uk_UA
  • vi
  • vi_VN
  • zh
  • zh_CN
  • zh_HK
  • zh_TW
maxFractionDigits Text
 
The maxFractionDigits attribute sets the maximum number of digits that will be formatted in the fractional portion of the output. Valid expressions must evaluate to an int.
maxIntegerDigits Text
 
The maxIntegerDigits attribute sets the maximum number of digits that will be formatted in the integer portion of the output. Valid expressions must evaluate to an int.
minFractionDigits Text
 
The minFractionDigits attribute sets the minimum number of digits that will be formatted in the fractional portion of the output. Valid expressions must evaluate to an int.
minIntegerDigits Text
 
The minIntegerDigits attribute sets the minimum number of digits that will be formatted in the integer portion of the output. Valid expressions must evaluate to an int.
pattern Enumerated
 
The pattern attribute sets the custom formatting pattern that determines how the number should be formatted. Valid patterns must conform to the syntax rules specified by java. text. DecimalFormat class. See the Java API documentation for more information.
type Enumerated
 
The type attribute specifies how the number string will be formatted. Valid values are "number", "currency", and "percentage". The default value is "number".

This attribute accepts the following values:

  • currency
  • number
  • percent