Hello

I can not load MessageResources from my custom file path. I can load for
<fmt:message/> taglib, but how can I do with <bean:message/>?

For example, here is my Struts action snippet:

URL[] urls = new URL[1];
try
{
        urls[0] = new URL("file:c:/my_dir/messages/");
}
catch (MalformedURLException e)
{
        log.error("Warning...");
}
URLClassLoader loader = new URLClassLoader(urls);
ResourceBundle bundle = ResourceBundle.getBundle("MessageResources", new
Locale("en"), loader);
javax.servlet.jsp.jstl.core.Config.set(request.getSession(),
javax.servlet.jsp.jstl.core.Config.FMT_LOCALIZATION_CONTEXT, new
LocalizationContext(bundle ,new Locale("en")));

Of course I have file c:/my_dir/messages/MessageResources_en.properties
And in my jsp I can do this:

<fmt:message key="my.key"/>

But if I add this to my action:

request.setAttribute(Globals.MESSAGES_KEY, bundle);
request.getSession().setAttribute(Globals.LOCALE_KEY, new Locale("en"));

And this in jsp:

<bean:message key="my.key"/>

Then I get from jsp:
java.lang.ClassCastException: java.util.PropertyResourceBundle

Anybody knows, how can I set ResourceBundle for <bean:message/> taglib or
how can I convert ResourceBundle to MessageResources?

Thanx.

Regards,
Andy


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

Reply via email to