You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Wellie W. Chao" <wc...@caraveltech.com> on 2002/04/02 22:36:41 UTC

Problem with org.apache.struts.util.PropertyMessageResources

I'm using struts 1.1-b1 and am having problems getting properties from my
ApplicationResources.properties. I have placed it in my classpath at
com/mycompany/myproject/ApplicationResources.properties and have configured
struts to use com.mycompany.myproject.ApplicationResources as the
message-resources file. When I execute the following code in a JSP page, I
get back com.mycompany.myproject.ApplicationResources, which is what I
expected:

((org.apache.struts.util.PropertyMessageResources)request.getAttribute("org.
apache.struts.action.MESSAGE")).getConfig()

When I try to fetch anything with <bean:message key="{XXX}"/>, it always
fails, no matter what I plug in for {XXX}. Is there any way for me to peek
inside of the PropertyMessageResources bundle to see what keys and values it
has? I think this problem is the cause of my errors not showing up with
<html:errors/> and <html:messages></html:messages>.


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


RE: Problem with org.apache.struts.util.PropertyMessageResources

Posted by "Wellie W. Chao" <wc...@caraveltech.com>.
OK. Figured it out with the PropertyMessageResources and the html:errors.
Apparently my ApplicationResources.properties file wasn't being included in
the WAR file during the build process. Perhaps this would be a good
modification to the class that loads and parses the file specified by
<message-resources> in struts-config.xml. There was absolutely no indication
to me that the file wasn't being loaded, and I spent quite a few hours
trying lots of different things to get at the contents of the
PropertyMessageResources object. It'd probably save people frustration in
the future to log a message saying, "could not find the
ApplicationResources.properties file specified as parameter in
<message-resources>."

-----Original Message-----
From: Wellie W. Chao [mailto:wchao@caraveltech.com]
Sent: Tuesday, April 02, 2002 3:37 PM
To: Struts Users Mailing List
Subject: Problem with org.apache.struts.util.PropertyMessageResources


I'm using struts 1.1-b1 and am having problems getting properties from my
ApplicationResources.properties. I have placed it in my classpath at
com/mycompany/myproject/ApplicationResources.properties and have configured
struts to use com.mycompany.myproject.ApplicationResources as the
message-resources file. When I execute the following code in a JSP page, I
get back com.mycompany.myproject.ApplicationResources, which is what I
expected:

((org.apache.struts.util.PropertyMessageResources)request.getAttribute("org.
apache.struts.action.MESSAGE")).getConfig()

When I try to fetch anything with <bean:message key="{XXX}"/>, it always
fails, no matter what I plug in for {XXX}. Is there any way for me to peek
inside of the PropertyMessageResources bundle to see what keys and values it
has? I think this problem is the cause of my errors not showing up with
<html:errors/> and <html:messages></html:messages>.


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


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