You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by red phoenix <ro...@gmail.com> on 2006/02/27 10:06:49 UTC

Cannot find message resources under key org.apache.struts.action.MESSAGE

I have configure my properties file,but when run,it raise error and say
can't find message key,my files are follows:
/*index.jsp*/
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<html:form method="post" action="log">
......
<html:errors property="logstime"/>
</html:form>

/*application.properties*/
error.header=<ul>
error.footer=</ul>
error.stime.required=This is a test

/*LogmanageForm.java*/
......
public ActionErrors validate(ActionMapping mapping,HttpServletRequest
request) {
    ActionErrors errors = new ActionErrors();
    ......
    errors.add("logstime",new ActionError("error.stime.required"));
    return errors;
}

/*web.xml*/
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
  <!-- Action Servlet Configuration -->
  <servlet>
   <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
  <init-param>
      <param-name>application</param-name>
      <param-value>resources.application</param-value>
    </init-param>
......


/*struts-config.xml*/
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
  <form-beans>
    <form-bean name="logmanageForm" type="com.LogmanageForm"/>
  </form-beans>
  <action-mappings>
    <action    path="/log"
               type="com.LogmanageAction"
               name="logmanageForm"
               validate="true"
               input="/index.jsp">
      <forward name="show" path="/show.jsp"/>
    </action>
  </action-mappings>
</struts-config>

application.properties is locate follow directory:
C:\tomcat5\webapps\Log\WEB-INF\classes\resources\application.properties

When the JSP execute <html:errors property="logstime"/>,it raise following
error:
javax.servlet.ServletException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(
PageContextImpl.java:791)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java
:1062)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(
RequestProcessor.java:1000)
org.apache.struts.action.RequestProcessor.processValidate(
RequestProcessor.java:965)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

I have configure the application.properties,why raise above error?
Thanks in advance!

Best Regards,
phoenix

Re: Cannot find message resources under key org.apache.struts.action.MESSAGE

Posted by Dharmendra Singh <ni...@gmail.com>.
Dear
First give the right tag URI in right form  in index.jsp
whatever u have given in web.xml


On 2/27/06, red phoenix <ro...@gmail.com> wrote:
>
> I have configure my properties file,but when run,it raise error and say
> can't find message key,my files are follows:
> /*index.jsp*/
> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
> <html:form method="post" action="log">
> ......
> <html:errors property="logstime"/>
> </html:form>
>
> /*application.properties*/
> error.header=<ul>
> error.footer=</ul>
> error.stime.required=This is a test
>
> /*LogmanageForm.java*/
> ......
> public ActionErrors validate(ActionMapping mapping,HttpServletRequest
> request) {
>    ActionErrors errors = new ActionErrors();
>    ......
>    errors.add("logstime",new ActionError("error.stime.required"));
>    return errors;
> }
>
> /*web.xml*/
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
> PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> <web-app>
> <!-- Action Servlet Configuration -->
> <servlet>
>   <servlet-name>action</servlet-name>
>    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> <init-param>
>      <param-name>application</param-name>
>      <param-value>resources.application</param-value>
>    </init-param>
> ......
>
>
> /*struts-config.xml*/
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE struts-config PUBLIC
>          "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
>          "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
> <struts-config>
> <form-beans>
>    <form-bean name="logmanageForm" type="com.LogmanageForm"/>
> </form-beans>
> <action-mappings>
>    <action    path="/log"
>               type="com.LogmanageAction"
>               name="logmanageForm"
>               validate="true"
>               input="/index.jsp">
>      <forward name="show" path="/show.jsp"/>
>    </action>
> </action-mappings>
> </struts-config>
>
> application.properties is locate follow directory:
> C:\tomcat5\webapps\Log\WEB-INF\classes\resources\application.properties
>
> When the JSP execute <html:errors property="logstime"/>,it raise following
> error:
> javax.servlet.ServletException: Cannot find message resources under key
> org.apache.struts.action.MESSAGE
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
> PageContextImpl.java:858)
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImpl.java:791)
> org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:91)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
> :332)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java
> :1062)
> org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(
> RequestProcessor.java:1000)
> org.apache.struts.action.RequestProcessor.processValidate(
> RequestProcessor.java:965)
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java
> :204)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> I have configure the application.properties,why raise above error?
> Thanks in advance!
>
> Best Regards,
> phoenix
>
>

Re: Cannot find message resources under key org.apache.struts.action.MESSAGE

Posted by Laurie Harper <la...@holoweb.net>.
Did you define the message resources in struts-config.xml? The init 
param in web.xml isn't used in current versions of Struts. Make sure you 
have this in your struts-config:

   <message-resources parameter="resources.application" null="true"/>

L.

red phoenix wrote:
> I have configure my properties file,but when run,it raise error and say
> can't find message key,my files are follows:
> /*index.jsp*/
> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
> <html:form method="post" action="log">
> .......
> <html:errors property="logstime"/>
> </html:form>
> 
> /*application.properties*/
> error.header=<ul>
> error.footer=</ul>
> error.stime.required=This is a test
> 
> /*LogmanageForm.java*/
> .......
> public ActionErrors validate(ActionMapping mapping,HttpServletRequest
> request) {
>     ActionErrors errors = new ActionErrors();
>     ......
>     errors.add("logstime",new ActionError("error.stime.required"));
>     return errors;
> }
> 
> /*web.xml*/
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> <web-app>
>   <!-- Action Servlet Configuration -->
>   <servlet>
>    <servlet-name>action</servlet-name>
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>   <init-param>
>       <param-name>application</param-name>
>       <param-value>resources.application</param-value>
>     </init-param>
> .......
> 
> 
> /*struts-config.xml*/
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE struts-config PUBLIC
>           "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
> <struts-config>
>   <form-beans>
>     <form-bean name="logmanageForm" type="com.LogmanageForm"/>
>   </form-beans>
>   <action-mappings>
>     <action    path="/log"
>                type="com.LogmanageAction"
>                name="logmanageForm"
>                validate="true"
>                input="/index.jsp">
>       <forward name="show" path="/show.jsp"/>
>     </action>
>   </action-mappings>
> </struts-config>
> 
> application.properties is locate follow directory:
> C:\tomcat5\webapps\Log\WEB-INF\classes\resources\application.properties
> 
> When the JSP execute <html:errors property="logstime"/>,it raise following
> error:
> javax.servlet.ServletException: Cannot find message resources under key
> org.apache.struts.action.MESSAGE
> org.apache.jasper.runtime.PageContextImpl.doHandlePageException(
> PageContextImpl.java:858)
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImpl.java:791)
> org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:91)
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java
> :332)
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java
> :1062)
> org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(
> RequestProcessor.java:1000)
> org.apache.struts.action.RequestProcessor.processValidate(
> RequestProcessor.java:965)
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:204)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 
> I have configure the application.properties,why raise above error?
> Thanks in advance!
> 
> Best Regards,
> phoenix
> 


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