File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF / GlassFish Locale question" Watch "JSF / GlassFish Locale question" New topic
Author

JSF / GlassFish Locale question

Ela Jarecka
Greenhorn

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

<locale-config>
<default-locale>de</default-locale>
<supported-locale>de</supported-locale>
</locale-config>

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: 16141
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ela Jarecka
Greenhorn

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: http://aspose.com/file-tools
 
subject: JSF / GlassFish Locale question