Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<fmt:bundle> defaults to english (in firefox)?

 
D. Ogranos
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my test project, I have two resource bundles: messages.properties (german) and messages_en.properties. The german version is intended to be the default.

I can access them in my controller like this:


Both when called from IE and from Firefox, this results in the same message (german). The request Locale is the same ("de_DE" when printed as request.getLocale().toString()), but I suppose that doesn't matter here since getBundle(name) uses the default (server) locale, right?

Then, in my JSP then I use the following:


When called from IE, this displays the german message, but when called from Firefox, this displays the english message. The request locale is the same for both browsers ("de_DE"). Why does the <fmt:bundle> tag get the wrong message bundle?

If I explicitely set the locale in the JSP with


then I get the correct message in Firefox too, but I don't understand why I need to do this (and if its the correct thing to do). I would have thought that the <fmt:bundle> tag uses something like getResourceBundle(name, locale) with the request locale, but apparently that's not what happens..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic