Hey Keith,

I think you've got it. You might want to check section 8.3 of the JSTL
specification on how JSTL does it's full Locale lookup, it might be that the
page author specified the preferred locale through the request attributes
and then you're thrown off-balance. There are some other exceptions to your
solution. Unfortunately the only way the logic from JSTL to determine the
Locale is available is when you've got a PageContext Object. Then you might
call LocaleSupport.getLocalizedMessage and be done with it.

As said, that method is unfortunately not available in a servlet or filter

Martin

-----Oorspronkelijk bericht-----
Van: Keith Hyland [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 12 maart 2004 19:56
Aan: Tag Libraries Users List
Onderwerp: Re: How to access Resource bundle from filter?


 > ResourceBundle myResources =
 >        ResourceBundle.getBundle("foo", locale);
 >

Thanks, I didn't actually know that which is a bit embarrasing, but ...

I want to get the resource used by the <fmt:message> tag lib. The one
specified in web.xml as

<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>

At the moment it looks like I have to jump through a few hoops to do this.

String rb =
session.getServletContext().getInitParameter("javax.servlet.jsp.jstl.fmt.loc
alizationContext");
Locale locale = (Locale)session.getAttribute(Config.FMT_LOCALE);
ResourseBundle.getBundle(rb, locale).getString(key);

Is this right?, or is some of the logic of the <fmt:message> tag
accessible outside of a jsp context?

Cheers,
Keith



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to