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

异常1:
Cannot find message resources under key org.apache.struts.action.MESSAGE


bug原因:没有在struts.xml配置ApplicationResources:
解决办法:
步骤1.struts-config-core.xml配置:
	<message-resources parameter="properties.ApplicationResources_cn" />
	<message-resources key="chinese" parameter="properties.ApplicationResources_cn" />
	<message-resources key="english" parameter="properties.ApplicationResources" />
	<message-resources key="cn" parameter="properties.ApplicationResources_cn" />
	<message-resources key="en" parameter="properties.ApplicationResources" />

步骤2.在下面系统文件夹加入properties文件
src/platform/Resource
              |_propertirs
                     |_ApplicationResources_cn.properties
                     |_ApplicationResources.properties






异常2:异常1解决以后,重启报异常
org.xml.sax.SAXParseException: The content of element type "struts-config" must match "(display-name?,description?,data-sources?,form-beans?,global-exceptions?,global-forwards?,action-mappings?,controller?,message-resources*,plug-in*)"



解决办法:
参考1: http://bigdragon.iteye.com/blog/1465018
参考2: http://blog.csdn.net/yunxihanherui/article/details/7486132
在web.xml启动struts1的地方加入:
   <!-- struts1配置文件 -->	
  <servlet>
    <servlet-name>struts1</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>
      /WEB-INF/classes/struts/core/struts-config-core.xml,
	  /WEB-INF/classes/struts/example/struts-config-example.xml,
	  /WEB-INF/classes/struts/tools/struts-config-document.xml
	  </param-value>
    </init-param>
    <init-param> 加入段代码就OK了!
      <param-name>validating</param-name>   
      <param-value>false</param-value>   
    </init-param> 
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>







参考资料: http://www.cnblogs.com/tjsquall/archive/2008/11/27/1342258.html




猜你喜欢

转载自ewf-momo.iteye.com/blog/1770151