Meaningless Drivel is fun!*
The moose likes JSP and the fly likes Different behaviour in internationalization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Different behaviour in internationalization" Watch "Different behaviour in internationalization" New topic
Author

Different behaviour in internationalization

Bob Mathews
Ranch Hand

Joined: Feb 26, 2006
Posts: 43
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

Joined: Jun 07, 2006
Posts: 34
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

Joined: Feb 26, 2006
Posts: 43
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

Joined: Nov 29, 2005
Posts: 2308
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.


Rahul Bhattacharjee
LinkedIn - Blog
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Different behaviour in internationalization