aspose file tools*
The moose likes Struts and the fly likes Multiple Message Resource File Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multiple Message Resource File Problem" Watch "Multiple Message Resource File Problem" New topic
Author

Multiple Message Resource File Problem

Neeraj Gupta
Greenhorn

Joined: Jun 21, 2003
Posts: 10
If you have the following in your struts-config.xml:
<message-resources parameter="ApplicationResources"/>
<message-resources key="CHANNELS_RESOURCE_KEY" parameter="ApplicationResourcesChannels" null="false"/>

Now, how do you access the second message-resource from your JSP....because

<bean:message key="abc.xyz"> refers only to first resource file.....
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Specify the bundle:

<bean:message key="abc.xyz" bundle="CHANNELS_RESOURCE_KEY"/>

You can also use a JSP expression:

// in Java

public class MyGlobals {
public static final String MYBUNDLE = "CHANNELS_RESOURCE_KEY";
}

// in JSP

<%@page import="MyGlobals" %>
...
<bean:message key="abc.xyz" bundle="<%= MyGlobals.MYBUNDLE %>" />


Junilu - [How to Ask Questions] [How to Answer Questions]
Neeraj Gupta
Greenhorn

Joined: Jun 21, 2003
Posts: 10
Thanks....it works perfectly fine !!!
HAPPY NEW YEAR TO YOU....
sonu arora
Ranch Hand

Joined: Jul 25, 2002
Posts: 30
Hi,

How can we use the same in a java file (Bean file) like..

This is in validate method of Bean Class


ActionErrors errors = new ActionErrors();
errors.add("Name", new ActionError("error.name"));
errors.add("Pass", new ActionError("error.pass"));

At present both keys are in one resource file.
I want to use both entries from 2 different resources.


try & try u ll surely win.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Message Resource File Problem