aspose file tools*
The moose likes Struts and the fly likes One more message-resources in struts-config.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "One more message-resources in struts-config.xml" Watch "One more message-resources in struts-config.xml" New topic
Author

One more message-resources in struts-config.xml

Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
hello,

Can I have multiple entries of message-resources in struts-config.xml?

I am using Jboss 4.0.4 GA.

Rgds,

Seetesh
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hello,

struts-config.xml
<message-resources parameter="application" />
<message-resources parameter="MessageResources" />

on declaring sample.seet in application.properties file I get the following error

javax.servlet.ServletException: Missing message for key "sample.seet"

rgds,

Seetesh
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hello

I tried the following but getting same Exception

"Cannot find message resources under key MessageResources"


<h3><bean:message bundle="MessageResources" key="welcome.heading"/></h3>
<p><bean:message bundle="MessageResources" key="welcome.message"/></p>

<h3><bean:message bundle="application" key="app.seet"/></h3>
<p><bean:message bundle="application" key="app2.seet"/></p>


Rgds,

Seetesh
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
When you define multiple message resource bundles, you must assign a key to all but one. The one you don't assign a key to will be the default bundle. example:

<message-resources parameter="application" key="application"/>
<message-resources parameter="MessageResources" />

If I want to use a message key in MessageResources.properties, since it's the default, I don't have to specify a bundle in <bean:message> and the following will work:

<bean:message key="my.key" />

But if I want to use a message key in application.properties, I must specify a bundle like this:

<bean:message bundle="application" key="other.key" />

This link is a very good reference on message resources in Struts.


Merrill
Consultant, Sima Solutions
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Yes Merrill, this link is very useful.

I was referring to this link too.

www.laliluna.de/struts-message-resources-tutorial.html

Rgds,

Seetesh
 
Consider Paul's rocket mass heater.
 
subject: One more message-resources in struts-config.xml