GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes NumberFormat, Locale and fmt:formatNumber Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "NumberFormat, Locale and fmt:formatNumber" Watch "NumberFormat, Locale and fmt:formatNumber" New topic
Author

NumberFormat, Locale and fmt:formatNumber

Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi,

I am confused about servlets vs. jsps working with locales. I developed an app on a linux machine with environment variable LANG set to de_DE.utf8.
I used NumberFormat.getInstance() and nf.parse() from a servlet and <fmt:formatNumber type="currency"> in a jsp, like this:





That worked well, until I deployed the app on another machine which had (which I didn't know earlier) LANG set to en_US.utf-8. Now, I can fix it by using NumberFormat.getInstance(LOCALE.GERMANY) - but what really puzzles me is why the jsp part - fmt:FormatNumber - worked allright all the same!
That is, when I first called my app with a certain value, it was formatted correctly (as if I'd configured the right locale)! Only the other way round, it didn't work - that is, nf.parse() did NOT use the German locale...

Can anybody give me a hint what's the matter here? Thanks in advance,
Sigrid
Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi,

I think I had better posted this on another forum... As I suppose it's forbidden to post the same thing twice, but I really am puzzled by this thing, I'd like to ask you to move this to a better suiting place (SCJP?)

Thanks a lot,
Sigrid
 
GeeCON Prague 2014
 
subject: NumberFormat, Locale and fmt:formatNumber