wood burning stoves 2.0*
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
Author

Struts Modules and message resources

Scott Collins
Greenhorn

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
Also,
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.
Thanks
Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
hi
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.propertis
abc.properties
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
Greenhorn

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: 213
I also have the same question. Please take a look.

http://www.coderanch.com/t/48236/Struts/Resource-Bundle-files-Modules-setup
Jeremy Tukif
Greenhorn

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

http://www.coderanch.com/t/48236/Struts/Resource-Bundle-files-Modules-setup


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,

J�r�my

[ September 28, 2005: Message edited by: Jeremy Tukif ]
[ September 28, 2005: Message edited by: Jeremy Tukif ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Modules and message resources