• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

multiple message resource file for multiple struts-config.xml

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
shah rah
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
appreciate your help. restarting the server made it work.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!