Your example works for setting JSTL's default localization context to use the
same resource bundle as Struts default message resource. In Ben's example, he's
using an alternate message resource which implies the need to change the
localization context.

One of the interesting things you can do with JSTL is to programatically set a
localization context in any of the different scopes. So, in an action (or filter
or ...), you could use:

import javax.servlet.jsp.jstl.core.Config;
...
Config.set(request,
           Config.FMT_LOCALIZATION_CONTEXT,
           "bundleBasename");
...

to set the localization context for the duration of the current request and
avoid specifying the bundle basename in your JSP.

Quoting "Raible, Matt" <[EMAIL PROTECTED]>:

> I did this today and it was pretty simple.  Check out
> http://tinyurl.com/gkp1.
> 
> HTH,
> 
> Matt
> 
> -----Original Message-----
> From: Ben Anderson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 10, 2003 1:44 PM
> To: [EMAIL PROTECTED]
> Subject: <fmt:message
> 
> 
> As per earlier requests, I attempted to switch my <bean:message tags to 
> <fmt:message tags, however I have been unsuccessful thus far.
> 
> This is what worked:
> keys are defined in MessagesMyBundle.properties
> 
> <code file="struts-config.xml">
>   ....
>       <message-resources key="MESSAGE_MY_BUNDLE"
>                        parameter="path.to.my.stuff.MessagesMyBundle"/>
>   ....
> </code>
> <code file="myJsp.jsp">
>   ....
>     <bean:message key="my.message.to.display" bundle="MESSAGE_MY_BUNDLE"/>
> </code>
> 
> 
> I changed to this and I can't seem to get it working
> <code file="myJsp.jsp">
>   ....
>     <fmt:setBundle baseName="MESSAGE_MY_BUNDLE" var="myBundle"/>
>     <fmt:message key="my.message.to.display bundle="${myBundle}"/>
> </code>
> 
> the page renders but instead of displaying the message, it displays
> "???my.message.to.display???"
> 
> did I put too much code in here?
> Thanks,
> Ben

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

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

Reply via email to