Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing Message Resource

 
Kalichar Rangantittu
Ranch Hand
Posts: 240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am looking for a way to access a message property that is maintained in the ApplicationResources.properties file in a Java class that is external to the Struts API.

I would like in a Java Class to be be able to say,

messageResource.get(key, locale) and get back the struts resource for the specified key.

Thanks in advance for any suggestions.
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do this outside struts API by using a ResourceBundle assuming your bundle is located at yourapp/WEB-INF/classes/resources/application_fr.properties. Then you an retrieve the messages from the bundle. The following code snippet would help you:
 
Durgaprasad Guduguntla
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One correction in the above post with code:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic