You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Smith, Darrin" <Da...@OraMetrix.com> on 2004/01/20 21:45:04 UTC

Missing message for key problem.

Every time I try to access my newly built application, I get:
Missing message for key "image.company" javax.servlet.jsp.JspException:
Missing message for key "image.company" at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:297) at
org.apache.jsp.header_jsp._jspx_meth_bean_message_0(header_jsp.java:86) at
org.apache.jsp.header_jsp._jspService...
 
I've researched this, posted to the web, and re-checked it a dozen times but
I can't figure out what I'm doing wrong.
 
Here is the path the properties file gets placed in after Tomcat expands the
war file: 

C:\Program Files\Apache Software Foundation\Tomcat
5.0\webapps\orders\WEB-INF\classes\com\company\product\orders 

There, you will find a file named: ApplicationResources.properties (note
that the ApplicationResources.properties name was cut/pasted from File
Explorer so there is no spelling mistake). 

In that file you will find the following (again, cut/paste): 
image.company=Company name 

In the web.xml file you will find the following (again, cut and paste): 


<servlet>

    <servlet-name>orders</servlet-name>

 
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

            <init-param>

                <param-name>application</param-name>

 
<param-value>com.company.product.orders.ApplicationResources</param-value>

            </init-param>

        <init-param>

            <param-name>config</param-name>

            <param-value>/WEB-INF/struts-config.xml</param-value>

        </init-param>


And finally, in the header.jsp file that tries to use the key you find this:


img src="Company_Logo.gif" align="left" alt="<bean:message
key="image.company"/>


Note that the header.jsp file is in this directory after Tomcat expands the
war file: 
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\orders 
 
I've tried removing the application param from the web.xml file and
replacing it in the struts-config.xml file like this:
<message-resources
parameter="com.company.product.orders.ApplicationResources"/>

 
That didn't help.
 
So what is it that I am doing wrong?
 
Thanks!
 
Darrin

 

RE: Missing message for key problem.

Posted by Richard Hightower <rh...@arc-mind.com>.
Does the problem go away after you access and Action?

Please, Send the URL that you send to the server.

Try this.

<action path="/index" forward="/index.jsp"/>

The above ensures that the resource bundle is intialized before hitting the
page for the first time.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-----Original Message-----
From: Smith, Darrin [mailto:Darrin.Smith@OraMetrix.com]
Sent: Tuesday, January 20, 2004 1:45 PM
To: struts-user@jakarta.apache.org
Subject: Missing message for key problem.


Every time I try to access my newly built application, I get:
Missing message for key "image.company" javax.servlet.jsp.JspException:
Missing message for key "image.company" at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:297) at
org.apache.jsp.header_jsp._jspx_meth_bean_message_0(header_jsp.java:86) at
org.apache.jsp.header_jsp._jspService...

I've researched this, posted to the web, and re-checked it a dozen times but
I can't figure out what I'm doing wrong.

Here is the path the properties file gets placed in after Tomcat expands the
war file:

C:\Program Files\Apache Software Foundation\Tomcat
5.0\webapps\orders\WEB-INF\classes\com\company\product\orders

There, you will find a file named: ApplicationResources.properties (note
that the ApplicationResources.properties name was cut/pasted from File
Explorer so there is no spelling mistake).

In that file you will find the following (again, cut/paste):
image.company=Company name

In the web.xml file you will find the following (again, cut and paste):


<servlet>

    <servlet-name>orders</servlet-name>


<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

            <init-param>

                <param-name>application</param-name>


<param-value>com.company.product.orders.ApplicationResources</param-value>

            </init-param>

        <init-param>

            <param-name>config</param-name>

            <param-value>/WEB-INF/struts-config.xml</param-value>

        </init-param>


And finally, in the header.jsp file that tries to use the key you find this:


img src="Company_Logo.gif" align="left" alt="<bean:message
key="image.company"/>


Note that the header.jsp file is in this directory after Tomcat expands the
war file:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\orders

I've tried removing the application param from the web.xml file and
replacing it in the struts-config.xml file like this:
<message-resources
parameter="com.company.product.orders.ApplicationResources"/>


That didn't help.

So what is it that I am doing wrong?

Thanks!

Darrin




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


Re: Missing message for key problem.

Posted by cn...@rayc.brevsville.com.au.
Hi Darrin,

I get the problem when I had my actionforms/action mappings incorrectly
specified. It has nothing to do with the messages at all.

On Tue, 20 Jan 2004, Smith, Darrin wrote:

> Every time I try to access my newly built application, I get:
> Missing message for key "image.company" javax.servlet.jsp.JspException:
> Missing message for key "image.company" at
> org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:297) at
> org.apache.jsp.header_jsp._jspx_meth_bean_message_0(header_jsp.java:86) at
> org.apache.jsp.header_jsp._jspService...
>
> I've researched this, posted to the web, and re-checked it a dozen times but
> I can't figure out what I'm doing wrong.
>
> Here is the path the properties file gets placed in after Tomcat expands the
> war file:
>
> C:\Program Files\Apache Software Foundation\Tomcat
> 5.0\webapps\orders\WEB-INF\classes\com\company\product\orders
>
> There, you will find a file named: ApplicationResources.properties (note
> that the ApplicationResources.properties name was cut/pasted from File
> Explorer so there is no spelling mistake).
>
> In that file you will find the following (again, cut/paste):
> image.company=Company name
>
> In the web.xml file you will find the following (again, cut and paste):
>
>
> <servlet>
>
>     <servlet-name>orders</servlet-name>
>
>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>
>             <init-param>
>
>                 <param-name>application</param-name>
>
>
> <param-value>com.company.product.orders.ApplicationResources</param-value>
>
>             </init-param>
>
>         <init-param>
>
>             <param-name>config</param-name>
>
>             <param-value>/WEB-INF/struts-config.xml</param-value>
>
>         </init-param>
>
>
> And finally, in the header.jsp file that tries to use the key you find this:
>
>
> img src="Company_Logo.gif" align="left" alt="<bean:message
> key="image.company"/>
>
>
> Note that the header.jsp file is in this directory after Tomcat expands the
> war file:
> C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\orders
>
> I've tried removing the application param from the web.xml file and
> replacing it in the struts-config.xml file like this:
> <message-resources
> parameter="com.company.product.orders.ApplicationResources"/>
>
>
> That didn't help.
>
> So what is it that I am doing wrong?
>
> Thanks!
>
> Darrin
>
>
>


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