aspose file tools*
The moose likes Struts and the fly likes multiple message resource file for multiple struts-config.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "multiple message resource file for multiple struts-config.xml" Watch "multiple message resource file for multiple struts-config.xml" New topic
Author

multiple message resource file for multiple struts-config.xml

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
I have struts-config-module1.xml and struts-config-module2.xml .

I created a message resource file inside struts-config-module1.xml
<message-resources parameter="module1" key="com.mycompany.struts.module1"/>

I have the file module1.properties under com.mycompany.struts. I also have
my application.properties(default) under the same directory.

Inside my jsp file I say

<bean:message bundle = "module1" key = "module1.Name" /> it does not work


if I provide a value for module1.Name inside my application.properties file...it works.

How do I tell my jsp file to look for the new message resource file and not the default one?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
It looks as though you've got the message-resources attributes reversed. Try:

and it should work.
[ February 06, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
<message-resources
key="LoginMsg"
null="false"
parameter="com.mycompany.struts.LoginMsgResources" />

<bean:message bundle = "LoginMsg" key = "Login.loginname"/>

my LoginMsgResources.properties is under com.mycompany.struts and has Login.loginname=Enter Login

It did not work... I get this when I preview ???Login.loginname???

appreciate your help.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Your code looks good. I know this technique works, as I've used it many times before. Just check to make sure that the file exists in web-inf/classes/com/mycompany/struts and that the message key exists in the properties file. Also, make sure you restart the server after making any changes in the struts-config.xml file.
shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124
appreciate your help. restarting the server made it work.
 
Don't get me started about those stupid light bulbs.
 
subject: multiple message resource file for multiple struts-config.xml