This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One more message-resources in struts-config.xml

 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Merrill, this link is very useful.

I was referring to this link too.

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

Rgds,

Seetesh
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic