aspose file tools*
The moose likes Struts and the fly likes Accessing  Message Resource 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 "Accessing  Message Resource" Watch "Accessing  Message Resource" New topic
Author

Accessing Message Resource

Kalichar Rangantittu
Ranch Hand

Joined: Jan 15, 2002
Posts: 240
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.


Never be satisfied with anything less than the best and you will surely pass the test...
Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
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:


Thanks,<br />Durgaprasad<br />SCJP1.4, SCWCD1.4, SCBCD1.3,<br />SCEA
Durgaprasad Guduguntla
Ranch Hand

Joined: Oct 20, 2003
Posts: 99
One correction in the above post with code:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing Message Resource