Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Struts: Missing message for key... (http://www.velocityreviews.com/forums/t130552-struts-missing-message-for-key.html)

Darrin 01-20-2004 06:23 PM

Struts: Missing message for key...
 
I keep getting a "Missing message for key..." error. Here is what the
application setup is:

1) I have an ApplicationResources.properties file located here:
\WEB-INF\classes\com\company\product\appname\Applicatio nResources.properties

2) In my web.xml file I have the following entry:

<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>appname</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>com.company.product.appname.ApplicationResou rces</param-value>
</init-param>



3) In that ApplicationResources.properties file I have the following:
image.company=Company Name

4) My .jsp that requests the key is in the top level directory (same
level as WEB-INF). In that file I have this:
img src="Company_Logo.gif" align="left" alt="<bean:message
key="image.company"/>"

When I try to load it, 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.doStartTa g(MessageTag.java:297)
at...

This is driving me crazy! I've tried copying the Application.Resources
file to every directory I could think of but nothing helps.

What am I doing wrong? All I could find on the net is this:
The key-value pair with specified key is not in
ApplicationResources.properties file

or

ApplicationResources.properties file not in classpath (not in
WEB-INF/classes directory in specified location)

Well, it is specified, and it is in the classpath.

Someone please tell me what I'm doing wrong!

Thanks!

Sudsy 01-21-2004 05:33 AM

Re: Struts: Missing message for key...
 
Darrin wrote:
> I keep getting a "Missing message for key..." error. Here is what the
> application setup is:
>
> 1) I have an ApplicationResources.properties file located here:
> \WEB-INF\classes\com\company\product\appname\Applicatio nResources.properties
>
> 2) In my web.xml file I have the following entry:
>
> <!-- Action Servlet Configuration -->
> <servlet>
> <servlet-name>appname</servlet-name>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
> <param-name>application</param-name>
> <param-value>com.company.product.appname.ApplicationResou rces</param-value>
> </init-param>


You're missing the following, which should go in your struts-config.xml
file:
<message-resources null="true" parameter="ApplicationResources"/>

Make sure that you put it in the right place according to the TLD. It
should appear after the <controller> tag and before and <plug-in>s.


esaiesai 04-22-2010 06:47 AM

Same issue I faced,....but then realized that the message resource file name should be mentioned in the web.xml with out the extension.

So, for example,

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>com........AppControllerServlet</servlet-class>

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

<init-param>
<param-name>application</param-name>
<param-value>AppErrorMessages</param-value>
</init-param>

Here, "AppErrorMessages" should not be mentioned as "AppErrorMessages.properties".

ahil23 07-21-2011 12:01 PM

Tht's great...
Actually i was searching google for this error.
And after seeing the velocity Reviews i did the denoted things in the web.xml and struts-config.xml.
Now its working...


All times are GMT. The time now is 08:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.