This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Different behaviour in internationalization

 
Bob Mathews
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The locale returned when we call Locale.getDefault() varies when run from the command line (using a small sample program) and when used in the JSP pages.



Sample code:



import java.util.*;



public class VBRCur {

public static void main(String[] args) {

System.out.println("---");

System.out.println(Locale.getDefault().getCountry());

System.out.println(Locale.getDefault());

System.out.println(java.util.Currency.getInstance(Locale.getDefault()).getSymbol());

System.out.println("---");

}

}



OS: Windows 2003 Server Standard Edition

Locale set on the host is: Danish



Command line output:

DK

da_DK

kr



JSP output:

GB

en_GB





Could you please shed some light on this behavior? Is this expected or a bug?
 
pawank gupta
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
defualt Locale access from the system property, may be when you are running it from jsp your app server change this property values. you can check system property value at both place i.e. stan alone and jsp
 
Bob Mathews
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
But can you please elaborate further on it
Its really urgent
From where can i access these system properties

Nishant
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The web server would inherit the local from the OS , but you might choose to override this while starting the server.look at the startup scripts of the server that you are using.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nishant Tiwari,
Welcome to JavaRanch!

In an effort to help you get the most from our forums, we've compiled a
list of tips for asking questions here. You can find the list in our
FAQ section here.
In particular please see:
EaseUp to find out why adding "urgent" to your posts will often slow down or eliminate responses altogether.

If it was urgent, why did you let the answer sit for six days before responding to it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic