deprecated getResources method

D

David McDivitt

I have the following code I wanted to put in a struts plugin:

servlet.getResources().getMessage("CommonFilesPath")

Unfortunately getResources is deprecated. I need to get a value from the
default message bundle, but cannot get it to work. My code is:

MessageResources messages =
MessageResources.getMessageResources("resources.ApplicationResources.properties");
String commonPath = messages.getMessage("CommonFilesPath");

The string commonPath is always null. I am sure my problem is when I create
the messages object and the string passed is inappropriate. Help would be
appreciated. Thanks
 
D

David McDivitt

Subject: Re: deprecated getResources method
Date: Tue, 18 May 2004 18:01:46 -0400

David McDivitt wrote:


Take a look here:
<http://www.sudsy.net/technology/struts-messageresources.html>
Pay particular attention to the null attribute. Setting null="false"
helps debug those situations where you request a key which doesn't
exist in your message store.

The following code works:

MessageResources messages =
MessageResources.getMessageResources("resources.ApplicationResources");
String commonPath = messages.getMessage("CommonFilesPath");

The text "properties" was removed from
"resources.ApplicationResources.properties", then it worked OK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,187
Latest member
RosaDemko

Latest Threads

Top