• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with firsttruts Application

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am getting either "Cannot find message resources under key org.apache.struts.action.MESSAGE" sometimes or "Missing message for key strutsApp.title". Everything seems to be OK, but I am not able to understand the reason. How do I attach files in this post?


Thanks,
TV Padmanabhan

Struts-config.xml:
-----------------
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">

<struts-config>
<form-beans>
<form-bean name="ContactsActionForm"
type="firstStrutsApp.ContactsActionForm"/>
<form-bean name="ContactsSearchActionForm"
type="firstStrutsApp.ContactsSearchActionForm"/>
</form-beans>
<global-forwards>
<forward name="success"
path="/success.jsp"
redirect="false"/>
<forward name="searchResults"
path="/searchResults.jsp"
redirect="false"/>
</global-forwards>
<action-mappings>
<action path="/ContactsStoreAction"
type="firstStrutsApp.ContactsStoreAction"
name="ContactsActionForm"
scope="session"
input="/index.jsp">
<forward name="success"
path="/success.jsp"
redirect="false"/>
</action>
<action path="/ContactsSearchAction"
type="firstStrutsApp.ContactsSearchAction"
name="ContactsSearchActionForm"
scope="session"
input="/index.jsp">
<forward name="searchResults"
path="/searchResults.jsp"
redirect="false"/>
</action>
</action-mappings>
<message-resources parameter="<b>firstStrutsApp.ApplicationResources</b>"/>
</struts-config>


<b>The "ApplicationResources.properties" is in "WEB-INF\classes\firstStrutsApp" directory.</b>

index.jsp
---------

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>

<html:html>
<head>
<title>
<bean:message key="<b>strutsApp.title</b>"/>
</title>
<body>
<h1><bean:message key="strutsApp.heading"/></h1>
<html:form action="ContactsStoreAction.do" focus="contactName">
<table>
<tr>
<td>
<bean:message key="strutsApp.contactName"/>
</td>
<td>
<html:text property="contactName" size="20"/>
</td>
<td>
<html:errors property="contactName"/>
</td>
</tr>
<tr>
<td>
<bean:message key="strutsApp.contactNumber"/>
</td>
<td>
<html:text property="contactNumber" size="20"/>
</td>
<td>
<html:errors property="contactNumber"/>
</td>
</tr>
<tr>
<td>
<bean:message key="strutsApp.contactCountry"/>
</td>
<td>
<html:text property="contactCountry" size="20"/>
</td>
<td>
<html:errors property="contactCountry"/>
</td>
</tr>
</table>
<html:submit>
<bean:message key="strutsApp.submit"/>
</html:submit>
<html:reset>
<bean:message key="strutsApp.reset"/>
</html:reset>
</html:form>
</body>
</html:html>


[ December 30, 2008: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Padmanabhan Venkitasubramanian:
Hi,
I am getting either "Cannot find message resources under key org.apache.struts.action.MESSAGE" sometimes or "Missing message for key strutsApp.title". Everything seems to be OK, but I am not able to understand the reason. How do I attach files in this post?


Thanks,
TV Padmanabhan


Hi TV ,

I think the Application.properties file is not placed in your package classpath .Make it available .And also use plain name as ApplicationResource(or Any name).properties.In your struts-config.xml.
Hopefully it should work.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This problem occurs when your .properties files are not on CLASSPATH, so make sure that you added this file on CLASSPATH. Also make sure that you spell the path correctly !!
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic