File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Modules and message resources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Modules and message resources" Watch "Struts Modules and message resources" New topic

Struts Modules and message resources

Scott Collins

Joined: Sep 06, 2003
Posts: 4
I have an application that has used <bean:message> for quite some time. I have had multiple struts-config files and each one defined message-resources that it needed. This all worked correctly
I just changed my application to use Struts Modules. I confirmed that I have everything working correctly with tiles and my navigation, but when I use a bean:message tag that references a message-resource definition in one of the module config-files, I get an error stating that
Cannot find message resources under key managementMessages
Where managementMessages is the name of the key in the <message-resources> declaration
The page being rendered is in the same Struts Module that the <message-resource> being requested is defined
If the <bean:message> tag references a <message-resources> in the default module, then it works correctly
Anyone come across this before? I am ready to ditch modules if I cannot get this working.
Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
USe this
<message-resources null="false" parameter="name of properties file"/>
<message-resources key="another name" null="false" parameter="another name"/>
here key name is same as parametere name
for eg
<message-resources null="false" parameter="xyz"/>
<message-resources key="abc" null="false" parameter="abc"/>
xyz is the default property file
and inside jsp u use the
for second properties file
<bean:message bundle="abc" key="lable.keyname"/>
for first one ther is no need to specify the bundle = " " (properties file name
hope u can understand this and will help u.
Scott Collins

Joined: Sep 06, 2003
Posts: 4
That didn't seem to do anything.
The only thing that worked was for me to copy the <message-resources>
definition from each module's struts-config file and put it into the struts-config file of the default module. This defeats the purpose of having modules.
Anyone else have any suggestions?
Benson Fung
Ranch Hand

Joined: Apr 10, 2003
Posts: 214
I also have the same question. Please take a look.
Jeremy Tukif

Joined: Sep 28, 2005
Posts: 2
Originally posted by Benson Fung:
I also have the same question. Please take a look.

Is the problem solved now? Because it seems that I have still the same problem: I have an application with several modules.
In one of this module, I define the two following messages resources:
<message-resources key="context" null="false" parameter="blabla.context.ApplicationResources"/>
<message-resources key="menu" null="false" parameter="blabla.authorization.ApplicationResources"/>.

And in my JSP, I have:
<bean:message bundle="context" key="myLocale"/>
=> When I want to display the page, I get the following error: "Cannot find message resources under key context"

However, if I add the module context path, it works:
<bean:message bundle="context/path_to_my_module" key="myLocale"/>

And I don't like the idea to "hardcode" my module path in each <bean:message> bundle property...

Thanks in advance,


[ September 28, 2005: Message edited by: Jeremy Tukif ]
[ September 28, 2005: Message edited by: Jeremy Tukif ]
I agree. Here's the link:
subject: Struts Modules and message resources
It's not a secret anymore!