You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Anuradha S.Athreya" <an...@world2web.com> on 2006/03/13 08:38:42 UTC

Using message resources in non-action class

In my struts application, I have resources file application.properties. This
has been configured in the struts-config.xml file 

 <message-resources key="allMessages" parameter="resources.application" />
 
 Now, I would like to use this in my source code , in a non-action class. 
 
 I tried the following 
 
 MessageResources messageresources =
MessageResources.getMessageResources("allMessages");
 
 When i tried to retrieve the message in the file 
 
 String message = messageresources.getMessage("username.invalid"); 
 
 the message is null,altho' corresponding message for the key
"username.invalid" is defined in the application.properties file.

Can someone indicate the missing link?

Regards,
Anuradha S.Athreya