File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF / GlassFish Locale question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF / GlassFish Locale question" Watch "JSF / GlassFish Locale question" New topic

JSF / GlassFish Locale question

Ela Jarecka

Joined: Mar 24, 2009
Posts: 10
In the faces-config.xml file of my web application ( written with PrimeFaces ) I set the following:


And then in one of my managed beans I have the following lines:

NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
formattedSum = numberFormat.format( getPaymentSuggestion().getPaymentSum() );

On my local Windows machine I get the Euro-sign but when it is run in production '$' signs appears. I've checked the browser settings on the remote machine, German "de-de" is in the first position, followed by "en-us" ( or just German on its own ).
In the GlassFish admin console the locale domain attribute is left empty. I've been told that we always install the multilingual version of GlassFish ( currently 3.1 ). The admin console is shown in German.

Could anyone tell me where I should look next? Is the problem caused by the settings of the remote machine? Or the GlassFish installation? Any help will be appreciated, I'm a total GlassFish newbie.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

The locale used by J2EE webapps when not explicitly requested by application code should be whatever locale the JVM running the appserver has been set up for. J2EE (and JSF) do not automatically get that information from the client.

An IDE is no substitute for an Intelligent Developer.
Ela Jarecka

Joined: Mar 24, 2009
Posts: 10
Thank you. I've just checked - the machine on which GlassFish is running has the following setting "LANG=en_US.UTF-8". I ( obviously wrongly ) assumed that setting the preffered language in the browser would set the request
language as well.
I agree. Here's the link:
subject: JSF / GlassFish Locale question
It's not a secret anymore!