How to retrieve JSTL resource bundle from plain java

From: Ron de Waard (ron_at_waard.demon.nl)
Date: 03/29/05


Date: 29 Mar 2005 04:02:43 -0800

Hello,

Our web-app uses Struts and JSTL combined with XSLT processing. For
the latter we want to use the same resource bundle as within Struts
and JSTL (we're using the preferred fmt:message now). Using Struts it
was easy to obtain the resource bundle by using:
MessageResources msgs =
(MessageResources)context.getAttribute(org.apache.struts.action.Action.MESSAGES_KEY);
This is deprecated however, but it works; I now can use this resource
bundle to translate some keys I want to use in XSLT transformations
(and more).

I want to do the same by obtaining the resource bundle from JSTL but
after searching everywhere I can't find the solution. Yes, I can
retrieve a single translated key, but I want to parse the whole
resourcebundle to our report engine. This tool must also work without
running in a web environment, and then I provide it with a standard
Java resource bundle.

Can anyone give me a clue how to obtain the resource bundle (with
choosen locale) as a object which can be used in plain Java code? I
want to get rid of the bean:message calls in favor of the fmt:message
calls.

Thanks in advance,

Ron de Waard
The Netherlands