Hi Ryan
I don't think specifying bundle inside fmt:message tag works at all. You
can workaround this problem by doing something like this
<fmt:bundle value= "${actionBean.resourceBundle}" > <fmt:message
key="label.key.here" /></fmt:bundle>
I don't remember exact spelling for fmt:bundle but it should be easy to
look it up.
The expected value for bundle is bundle name, which is a string - I your
example you are passing implementation of resource bundle.
Specifying bundle name helps to play with multiple bundles at the same
time. It looks like you have one bundle but you want JSTL to use Spring
implementation to load it as oppose to default one. I don't know how to
do it, but I am sure Spring's forum must have an example.
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Asleson, Ryan
Sent: Thursday, May 15, 2008 6:02 AM
To: Stripes Users List
Subject: [Stripes-users] Specifying ResourcesBundles in <fmt:message>
Tag
Hello,
This question isn't necessarily Stripes specific, but with Stripes' good
support for i18n I'll ask it anyways.
I want to create a ResourceBundle system that can be reloaded at
runtime, without having to redeploy the application with a new
StripesResources file.
To do this, I used the Spring MessageSourceResourceBundle (which extends
ResourceBundle) which is backed by a Spring
ReloadableResourceBundleMessageSource (which provides the functionality
for the bundle to be reloaded at runtime). Next, I created a class that
implements LocalizationBundleFactory and plugged it into Stripes as
recommended; this class returns the instance of the
MessageSourceResourceBundle.
Now, in my JSP when I'm trying to insert localized text, I figured I'd
use the JSTL <fmt:message> tag. Since I'm not using the "basic"
StripesResources bundle, I thought I'd have to provide the
ResourceBundle to the <fmt:message> tag using the "bundle" attribute. I
created an accessor on my ActionBean for the MessageSourceResourceBundle
and tried to use this tag:
<fmt:message bundle="${actionBean.resourceBundle}" key="label.key.here"
/>
But adding the "bundle" attribute causes this failure to occur:
org.apache.jasper.JasperException: java.lang.IllegalArgumentException:
Cannot convert
[EMAIL PROTECTED]
of type class
org.springframework.context.support.MessageSourceResourceBundle to class
javax.servlet.jsp.jstl.fmt.LocalizationContext
All the documentation I've read says that the "bundle" attribute of
<fmt:message> takes a ResourceBundle, but doing so causes a failure. As
a sanity check I also had actionBean.resourceBundle return a regular ol'
ResourceBundle but it failed with a similar message.
Can anybody shed some light on why I can't provide a ResourceBundle to
the <fmt:message> tag? Or how I should go about displaying localized
text on the JSP?
Thank you!!
-Ryan
This e-mail message is being sent solely for use by the intended
recipient(s) and may contain confidential information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not
the intended recipient, please contact the sender by phone or reply by
e-mail, delete the original message and destroy all copies. Thank you.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users