BobThis tutorial from Nick Heudecker may helpAssuming you place ApplicationResources.properties,FrenchApplicationResources.properties in WEB-INF/classes<message-resources key="EnglishResources" parameter="ApplicationResources"/> <message-resources key="FrenchApplicationResources" parameter="FrenchApplicationResources"/>The most common Struts tag to use is the bean:message tag. This tag allows you to load a specific message resource from the bundle using the "key" attribute. It also allows you to populate any or all of the four arguments in the value: <bean:message bundle="FrenchApplicationResources" key="some.message.key"/>The html:message tag allows you to display errors (default) or messages to the user, while html:errors will only display error messages. Messages and errors must be present in the request, obviously, or there will be nothing to display. Here is an example of displaying the messages:

<logic:messagesPresent message="true">
 <html:messages id="msg" message="true">
   <div class="success">
     <bean:write name="msg"/>
   </div><br/>
 </html:messages>
</logic:messagesPresent>
Anyone else?Martin------ Original Message ----- From: "Bob Arnott" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <user@struts.apache.org>; "'Martin Gainty'" <[EMAIL PROTECTED]>
Sent: Thursday, May 26, 2005 6:14 AM
Subject: RE: JSTL fmt:message with modules


Martin Gainty wrote:
Bob-
assuming you set userLocale to english north america
<table bgcolor="#d0d0d0" cellspacing="0" cellpadding="5"
border="0" width="100%">
<tr>
<td>
<center> <h2>
<fmt:setLocale value="<%=userLocale%>"/>
<fmt:bundle
  basename="com.abcbank.example.ApplicationResources">
<fmt:message key="header.title"/> </fmt:bundle>
</h2>
<br>
</td>
</tr>
</table>

so in the jsp if variable userLocale is set as Locale
userLocale = new Locale("fr", "CA");
header.title key is located in
ApplicationResources_fr_CA.properties located on the
com/abcbank/example folder
and if header.title = Banque de Quebec
that is what you would see

I'm not asking about locales, I'm asking how you tell the <fmt:message />
tag which bundle to use when you have multiple default bundles as a result
of having multiple modules.

I currently have an application that has four modules, each with multiple
resource bundles. I access the default resource bundles in each module:

<bean:message key="message.key" /> or,
<bean:message key="message.key" bundle="bundle.key" />

Struts stores the bundles in the application scope with the module name
appended to the Globals.MESSAGE_KEY constant, for example -

org.apache.struts.action.MESSAGE/moduleOne

I'm writing a new app and I've decided to use JSTL instead of the non
struts-el tags. Now I probably didn't make myself clear in my last post,
does Struts do something so that the <fmt:message /> tag works in a similar
way, thus you can do:

<fmt:message key="message.key" bundle="${Globals.MESSAGE_KEY}" />

So that it doesn't matter what module you are in you'll get the right
bundle...?

Cheers,

--
Bob Arnott



---------------------------------------------------------------------
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