Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF / GlassFish Locale question

 
Ela Jarecka
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ela Jarecka
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic