This question already has an answer here:
Set decimal separator when using f:convertNumber
(1个答案)
4年前关闭。
我想四舍五入到小数点后一位的值。这就是为什么我使用
四舍五入是正确的,但是
2.从支持的bean设置语言环境,并通过转换器读取:
3,设置本地转换器
好吧,感谢BalusC他回答了所有问题:)在这里您还可以找到示例,所以我感到有点内and,并获得了可用本地人的输出(格式为1000000):
(1个答案)
4年前关闭。
我想四舍五入到小数点后一位的值。这就是为什么我使用
f:convertNumber
的原因:<h:outputText value="${current.dayAverage.pressureRelative}" >
<f:convertNumber maxFractionDigits="1"/>
</h:outputText>
四舍五入是正确的,但是
f:convertNumber
添加了千位逗号分隔符。我想删除此分隔符,但不知道如何。我正在使用Apache MyFaces 2.1实现。在API for f:convertNumber中,它没有任何属性来指定千位分隔符。我想这可以在locale属性中定义吗? 最佳答案
您是对的,因为默认语言环境。您有几种选择:
1.从faces-config设置默认语言环境:
<locale-config>
<default-locale>de</default-locale>
<supported-locale>en_US</supported-locale>
<supported-locale>es</supported-locale>
<supported-locale>de</supported-locale>
<supported-locale>fr_FR</supported-locale>
<supported-locale>it_IT</supported-locale>
<supported-locale>pt_br</supported-locale>
</locale-config>
2.从支持的bean设置语言环境,并通过转换器读取:
<f:convertNumber locale="#{bean.locale}" />
3,设置本地转换器
<f:convertNumber locale="en-US" />
好吧,感谢BalusC他回答了所有问题:)在这里您还可以找到示例,所以我感到有点内and,并获得了可用本地人的输出(格式为1000000):
ja_JP Japanese (Japan) 1,000,000
es_PE Spanish (Peru) 1.000.000
en English 1,000,000
ja_JP_JP Japanese (Japan,JP) 1,000,000
es_PA Spanish (Panama) 1,000,000
sr_BA Serbian (Bosnia and Herzegovina) 1.000.000
mk Macedonian 1.000.000
es_GT Spanish (Guatemala) 1,000,000
ar_AE Arabic (United Arab Emirates) 1,000,000
no_NO Norwegian (Norway) 1 000 000
sq_AL Albanian (Albania) 1.000.000
bg Bulgarian 1 000 000
ar_IQ Arabic (Iraq) 1,000,000
ar_YE Arabic (Yemen) 1,000,000
hu Hungarian 1 000 000
pt_PT Portuguese (Portugal) 1.000.000
el_CY Greek (Cyprus) 1.000.000
ar_QA Arabic (Qatar) 1,000,000
mk_MK Macedonian (Macedonia) 1.000.000
sv Swedish 1 000 000
de_CH German (Switzerland) 1'000'000
en_US English (United States) 1,000,000
fi_FI Finnish (Finland) 1 000 000
is Icelandic 1.000.000
cs Czech 1 000 000
en_MT English (Malta) 1,000,000
sl_SI Slovenian (Slovenia) 1.000.000
sk_SK Slovak (Slovakia) 1 000 000
it Italian 1.000.000
tr_TR Turkish (Turkey) 1.000.000
zh Chinese 1,000,000
th Thai 1,000,000
ar_SA Arabic (Saudi Arabia) 1,000,000
no Norwegian 1 000 000
en_GB English (United Kingdom) 1,000,000
sr_CS Serbian (Serbia and Montenegro) 1.000.000
lt Lithuanian 1 000 000
ro Romanian 1.000.000
en_NZ English (New Zealand) 1,000,000
no_NO_NY Norwegian (Norway,Nynorsk) 1 000 000
lt_LT Lithuanian (Lithuania) 1 000 000
es_NI Spanish (Nicaragua) 1,000,000
nl Dutch 1.000.000
ga_IE Irish (Ireland) 1,000,000
fr_BE French (Belgium) 1.000.000
es_ES Spanish (Spain) 1.000.000
ar_LB Arabic (Lebanon) 1,000,000
ko Korean 1,000,000
fr_CA French (Canada) 1 000 000
et_EE Estonian (Estonia) 1 000 000
ar_KW Arabic (Kuwait) 1,000,000
sr_RS Serbian (Serbia) 1.000.000
es_US Spanish (United States) 1,000,000
es_MX Spanish (Mexico) 1,000,000
ar_SD Arabic (Sudan) 1,000,000
in_ID Indonesian (Indonesia) 1.000.000
ru Russian 1 000 000
lv Latvian 1 000 000
es_UY Spanish (Uruguay) 1.000.000
lv_LV Latvian (Latvia) 1 000 000
iw Hebrew 1,000,000
pt_BR Portuguese (Brazil) 1.000.000
ar_SY Arabic (Syria) 1,000,000
hr Croatian 1.000.000
et Estonian 1 000 000
es_DO Spanish (Dominican Republic) 1,000,000
fr_CH French (Switzerland) 1'000'000
hi_IN Hindi (India) ?,???,???
es_VE Spanish (Venezuela) 1.000.000
ar_BH Arabic (Bahrain) 1,000,000
en_PH English (Philippines) 1,000,000
ar_TN Arabic (Tunisia) 1,000,000
fi Finnish 1 000 000
de_AT German (Austria) 1.000.000
es Spanish 1.000.000
nl_NL Dutch (Netherlands) 1.000.000
es_EC Spanish (Ecuador) 1.000.000
zh_TW Chinese (Taiwan) 1,000,000
ar_JO Arabic (Jordan) 1,000,000
be Belarusian 1 000 000
is_IS Icelandic (Iceland) 1.000.000
es_CO Spanish (Colombia) 1.000.000
es_CR Spanish (Costa Rica) 1,000,000
es_CL Spanish (Chile) 1.000.000
ar_EG Arabic (Egypt) 1,000,000
en_ZA English (South Africa) 1,000,000
th_TH Thai (Thailand) 1,000,000
el_GR Greek (Greece) 1.000.000
it_IT Italian (Italy) 1.000.000
ca Catalan 1.000.000
hu_HU Hungarian (Hungary) 1 000 000
fr French 1 000 000
en_IE English (Ireland) 1,000,000
uk_UA Ukrainian (Ukraine) 1 000 000
pl_PL Polish (Poland) 1 000 000
fr_LU French (Luxembourg) 1 000 000
nl_BE Dutch (Belgium) 1.000.000
en_IN English (India) 1,000,000
ca_ES Catalan (Spain) 1.000.000
ar_MA Arabic (Morocco) 1,000,000
es_BO Spanish (Bolivia) 1.000.000
en_AU English (Australia) 1,000,000
sr Serbian 1.000.000
zh_SG Chinese (Singapore) 1,000,000
pt Portuguese 1.000.000
uk Ukrainian 1 000 000
es_SV Spanish (El Salvador) 1,000,000
ru_RU Russian (Russia) 1 000 000
ko_KR Korean (South Korea) 1,000,000
vi Vietnamese 1.000.000
ar_DZ Arabic (Algeria) 1,000,000
vi_VN Vietnamese (Vietnam) 1.000.000
sr_ME Serbian (Montenegro) 1.000.000
sq Albanian 1.000.000
ar_LY Arabic (Libya) 1,000,000
ar Arabic 1,000,000
zh_CN Chinese (China) 1,000,000
be_BY Belarusian (Belarus) 1 000 000
zh_HK Chinese (Hong Kong) 1,000,000
ja Japanese 1,000,000
iw_IL Hebrew (Israel) 1,000,000
bg_BG Bulgarian (Bulgaria) 1 000 000
in Indonesian 1.000.000
mt_MT Maltese (Malta) 1,000,000
es_PY Spanish (Paraguay) 1.000.000
sl Slovenian 1.000.000
fr_FR French (France) 1 000 000
cs_CZ Czech (Czech Republic) 1 000 000
it_CH Italian (Switzerland) 1'000'000
ro_RO Romanian (Romania) 1.000.000
es_PR Spanish (Puerto Rico) 1,000,000
en_CA English (Canada) 1,000,000
de_DE German (Germany) 1.000.000
ga Irish 1,000,000
de_LU German (Luxembourg) 1.000.000
de German 1.000.000
es_AR Spanish (Argentina) 1.000.000
sk Slovak 1 000 000
ms_MY Malay (Malaysia) 1,000,000
hr_HR Croatian (Croatia) 1.000.000
en_SG English (Singapore) 1,000,000
da Danish 1.000.000
mt Maltese 1,000,000
pl Polish 1 000 000
ar_OM Arabic (Oman) 1,000,000
tr Turkish 1.000.000
th_TH_TH Thai (Thailand,TH) ?,???,???
el Greek 1.000.000
ms Malay 1,000,000
sv_SE Swedish (Sweden) 1 000 000
da_DK Danish (Denmark) 1.000.000
es_HN Spanish (Honduras) 1,000,000
关于jsf-2 - f:convertNumber删除逗号作为千位分隔符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11835888/
10-11 23:59