You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matthew T Wall <mt...@us.ibm.com> on 2006/08/18 19:31:38 UTC

message-resources with keys don't work

I need assistance with a very unique problem.

I am working on a struts based project that uses multiple property files.
We are running it off of a servlet defined with multiple strut configs.
The project is run with IBM Websphere 5.1, Servlet 2.3, JSP 1.2, and Struts
1.1 beta.  The problem is that using a message-resources defined with a key
does not work.  I have performed many experiments to try and track the
problem down.  Here's what I've discovered:

<> Using a message-resource DOES work if a key is not defined.

<> When a key is defined, having something like <bean:message bundle="foo"
key="bar" /> will produce an exception like "Could not find bundle under
key foo"

<> However, having a message-resource defined with a key of
"org.apache.struts.action.MESSAGE" DOES work, and works whether you access
it by <bean:message bundle="org.apache.struts.action.MESSAGE" key="bar" />
or <bean:message key="bar" />

<> This problem occurs anywhere in the servlet, regardless of the struts
config that I use.

<> Upgrading struts to 1.2.7 did not fix the problem.

This problem seems to be with the servlet.  It has been in use for a while
now, but it seems that this is a pre-existing problem that wasn't detected
because nobody ever tried using multiple property files.  Here's the
web.xml that the servlet uses:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app id="WebApp">
      <display-name>FixToolsWeb</display-name>
      <context-param>
            <param-name>NavigationFile</param-name>
            <param-value>com/ibm/sdwb/cpsweb/resources/Navigation.xml</
param-value>
            <description>Navigation File</description>
      </context-param>
      <context-param>
            <param-name>NavigationFile/ve</param-name>
            <param-value>com/ibm/sdwb/cpsweb/ve/Navigation.xml</param-value
>
            <description>Navigation File</description>
      </context-param>
      <context-param>
            <param-name>NavigationFile/fix</param-name>
            <param-value>com/ibm/sdwb/cpsweb/fix/Navigation.xml</
param-value>
            <description>Navigation File</description>
      </context-param>
      <context-param>
            <param-name>NavigationFile/ec</param-name>
            <param-value>com/ibm/sdwb/cpsweb/ec/Navigation.xml</param-value
>
            <description>Navigation File</description>
      </context-param>
      <context-param>
            <param-name>NavigationFile/cr</param-name>
            <param-value>com/ibm/sdwb/cpsweb/cr/Navigation.xml</param-value
>
            <description>Navigation File</description>
      </context-param>
      <listener>
            <listener-class>com.ibm.sdwb.cpsweb.FixWebListener</
listener-class>
      </listener>
      <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</
servlet-class>
            <init-param>
                  <param-name>config/common</param-name>
                  <param-value>common/struts-common-config.xml</param-value
>
            </init-param>
            <init-param>
                  <param-name>config/fix</param-name>
                  <param-value>fix/struts-fix-config.xml</param-value>
            </init-param>
            <init-param>
                  <param-name>config/ec</param-name>
                  <param-value>ec/struts-ec-config.xml</param-value>
            </init-param>
            <init-param>
                  <param-name>config/cr</param-name>
                  <param-value>cr/struts-cr-config.xml</param-value>
            </init-param>
            <init-param>
                  <param-name>config/ve</param-name>
                  <param-value>ve/struts-ve-config.xml</param-value>
            </init-param>
            <init-param>
                  <param-name>config/cpse</param-name>
                  <param-value>cpse/struts-cpse-config.xml</param-value>
            </init-param>
            <init-param>
                  <param-name>config/cpseadmin</param-name>
                  <param-value>cpseadmin/struts-cpseadmin-config.xml</
param-value>
            </init-param>
            <init-param>
                  <param-name>debug</param-name>
                  <param-value>0</param-value>
            </init-param>
            <init-param>
                  <param-name>detail</param-name>
                  <param-value>0</param-value>
            </init-param>
            <init-param>
                  <param-name>validate</param-name>
                  <param-value>true</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
      </servlet>
      <servlet>
            <servlet-name>FixInitServlet</servlet-name>
            <display-name>FixInitServlet</display-name>
            <servlet-class>com.ibm.sdwb.cpsweb.FixInitServlet</
servlet-class>
            <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet>
            <servlet-name>StorageServlet</servlet-name>
            <display-name>StorageServlet</display-name>
            <servlet-class>com.ibm.bldcommon.storage.http.StorageServlet</
servlet-class>
      </servlet>
      <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.wss</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
            <servlet-name>StorageServlet</servlet-name>
            <url-pattern>/fix/StorageServlet</url-pattern>
      </servlet-mapping>
      <welcome-file-list>
            <welcome-file>index.html</welcome-file>
      </welcome-file-list>
      <taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>/WEB-INF/struts-html-el.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html-el.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>/WEB-INF/struts-nested.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>/WEB-INF/struts-template.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-template.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/application-1.0</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-application.jar</
taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/page-1.0</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-page.jar</taglib-location
>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/request-1.0</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-request.jar</
taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/response-1.0</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-response.jar</
taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/session-1.0</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-session.jar</
taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/datetime-1.0</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-datetime.jar</
taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/string-1.0.1</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-string.jar</
taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/utility</
taglib-uri>
            <taglib-location>/WEB-INF/lib/utility.jar</taglib-location>
      </taglib>
      <taglib>
            <taglib-uri>http://jakarta.apache.org/taglibs/mailer-1.1</
taglib-uri>
            <taglib-location>/WEB-INF/lib/taglibs-mailer.jar</
taglib-location>
      </taglib>
            <taglib>
            <taglib-uri>/WEB-INF/w3v8-components-taglib.tld</taglib-uri>
            <taglib-location>/WEB-INF/w3v8-components-taglib.tld</
taglib-location>
      </taglib>
</web-app>


Any help with this issue would be much appreciated.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org