Re: Need help w. ResourceBundle

From: Oscar kind (oscar_at_danwa.net)
Date: 08/28/04


Date: Sat, 28 Aug 2004 23:45:08 +0200

Mr. Steve R. Burrus <burrus1@swbell.net> wrote:
> Hi all, I am working on a simple "HelloWorldExample.java" servlet, and there
> are 2 lines of code in it: "ResourceBundle rb =
> ResourceBundle.getBundle("LocalStrings",request.getLocale());",
> and it compiles okay for me, but when I try to execute it in my browser, I
> get all sorts of "MissingResourceExceptions" java exceptions!!

As specified in another post, you put the properties files in
WEB-INF/classes. This is good.

Now, assume the the ResourceBundle is called "LocalStrings", the Locale
specified is Dutch, and the default locale is US english. Then according
to the API, the code looks for the first of these files it can find:
- LocalStrings_nl_NL.propertyies
- LocalStrings_nl.properties
- LocalStrings_en_US.propertyies
- LocalStrings_en.properties
- LocalStrings.properties

Does either one of the files needed exist? Does the last one (always have
a default)?

If the file does exist, a MissingResourceException is thrown when a given
key doesn't exist. So that's a second place you may want to look.

-- 
Oscar Kind                                    http://home.hccnet.nl/okind/
Software Developer                    for contact information, see website
PGP Key fingerprint:    91F3 6C72 F465 5E98 C246  61D9 2C32 8E24 097B B4E2


Relevant Pages

  • Re: Need help w. ResourceBundle
    ... > and it compiles okay for me, but when I try to execute it in my browser, I ... And don't be knocking Tony! ...
    (comp.lang.java.programmer)
  • Re: Locale in JavaScript?
    ... getting the locale in JavaScript. ... nasty advice - using the language setting is worse than nothing. ... My timezone is GMT+10. ... The language setting for a browser has no bearing on geographical ...
    (comp.lang.javascript)
  • Cant search from www.cookbook.com.
    ... # This is the query file for the query.htm query form. ... # Don't allow more than 300 total hits in the result set. ... # the browser. ... # The locale effects the formatting of dates, times, and numbers. ...
    (microsoft.public.inetserver.indexserver)
  • Re: browser display of accented characters
    ... Setting locale failed). ... characters in my browser still persists. ...
    (Debian-User)
  • HTTP_ACCEPT_HEADER
    ... about every browser in which I tried it: ... (PC OS is in US English, locale is US) ... could someone please explain what the values returned by Firefox Mac ...
    (php.general)