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