You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Richards, Devin N (Devin)" <de...@lucent.com> on 2002/08/10 07:09:28 UTC

Multiple files

Nightly Build (as of 20020801) of struts-1.1

I fear that my senses are getting dull as I can't quite figure this out. 
I would like to have multiple files to keep my local specific messages in. Specifically we want to have a "standard" ApplicationResources at the com.mycompany.myapp level to hold all standard labels/messages like "First Name" etc. then we would want a form/page specific file in the com.mycompany.myapp.myform level to hold things like instructions for filling out a form.

I have the following 2 definitions in my struts-config.xml:
<message-resources parameter="com.mycompany.myapp.ApplicationResources" />
<message-resources key="com.mycompany.myapp.myform" parameter="com.mycompany.myapp.myform.myformResources" />

The first file is the "default" or global definition file, the second is the form specific one

In my Java code:
MessageResources messages = MessageResources.getMessageResources(MESSAGE_KEY);
MessageResources myformMessages = MessageResources.getMessageResources("com.mycompany.myapp.myform");

Then I could use messages.getMessage(mykey) to get a message from the "default" file, and myformMessages.getMessage(mykey2) to get a message from the form specific message file

In my JSP code:
<bean:message key="mykey" />
<bean:message bundle="com.mycompany.myapp.myform" />

The first would get the text for the mykey message from the default file, and the second would get it from the myform file.

The problem is, this doesn't work, I keep getting nulls. I know this can be done, and even remember seeing a similar example (can't find the url of course!) and now, my simple examples don't even work. Any ideas would be appreciated, I will try again in the morning after a few cups of coffee!

TIA

-Devin

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>