This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSF and the fly likes problem with f:convertNumber and decimals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "problem with f:convertNumber and decimals" Watch "problem with f:convertNumber and decimals" New topic
Author

problem with f:convertNumber and decimals

Cesar Coz
Ranch Hand

Joined: Aug 19, 2010
Posts: 32
I want to separate the decimals with this simbol --> . <-- (a dot)

im using this code



and im getting the conversion like this '200,00' using a , and not a .

does anyone know how to solve this ?

Cesar Coz.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16160
    
  21

Your JVM is apparently running under a spanish locale. The simple number (and date) formatting services have picked the notation appropriate for that locale, which would be "123.456.789,00" instead of the English "123,456,789.00" format. It could be worse. I think in Peru, it's more like "1234'5678'9000" and I don't recall if they use "," or "." for the decimal point.

Your options are as follows. Pick one:

1. Override the default locale for the JVM

2. Override the locale setting on the converter by including an explicit locale attribute.

3. Supply your own custom format pattern.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: problem with f:convertNumber and decimals