File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Different behaviour in internationalization" Watch "Different behaviour in internationalization" New topic

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) {








OS: Windows 2003 Server Standard Edition

Locale set on the host is: Danish

Command line output:




JSP output:



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
But can you please elaborate further on it
Its really urgent
From where can i access these system properties

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

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:
subject: Different behaviour in internationalization
It's not a secret anymore!