[url]http://www.cnblogs.com/tjsquall/archive/2008/11/27/1342258.html[/url]
运行程序出现[color=blue]Cannot find message resources under key org.apache.struts.action.MESSAGE[/color]错误,是说明找不到ApplicationResources.properties,要注意以下四方面。
第一:在web.xml文件<web-app> <servlet>"把下面的内容放在这里"</servlet></web-app>中加入
[color=red] <init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>[/color]
第二:在struts-config.xml中加入如下设置:
[color=red]<message-resources parameter="ApplicationResources"/>[/color]
该设置最好放在:</action-mappings>"放到这里"</struts-config>
第三:确保ApplicationResources.properties文件在你建立的WEB-INF\classes文件夹中。
可以把applicationResources.properties放到classes文件夹下其它目录,例如:
把ApplicationResources.properties放入WEB-INF\classes\mydir文件夹下。struts-config.xml中的设置必须改
[color=red]<message-resources parameter="mydir/ApplicationResources"/>[/color]
第四:就可能是键值的问题,struts的资源文件也是可以分多资源文件配置的,比如配备是这样的
[color=red] <message-resources parameter="ApplicationResources" key="myAppRes"/> [/color]
如果只有一个带key的资源文件,那就会抛出 org.apache.struts.action.MESSAGE错误了,删除key即可。[color=red][/color]
运行程序出现[color=blue]Cannot find message resources under key org.apache.struts.action.MESSAGE[/color]错误,是说明找不到ApplicationResources.properties,要注意以下四方面。
第一:在web.xml文件<web-app> <servlet>"把下面的内容放在这里"</servlet></web-app>中加入
[color=red] <init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>[/color]
第二:在struts-config.xml中加入如下设置:
[color=red]<message-resources parameter="ApplicationResources"/>[/color]
该设置最好放在:</action-mappings>"放到这里"</struts-config>
第三:确保ApplicationResources.properties文件在你建立的WEB-INF\classes文件夹中。
可以把applicationResources.properties放到classes文件夹下其它目录,例如:
把ApplicationResources.properties放入WEB-INF\classes\mydir文件夹下。struts-config.xml中的设置必须改
[color=red]<message-resources parameter="mydir/ApplicationResources"/>[/color]
第四:就可能是键值的问题,struts的资源文件也是可以分多资源文件配置的,比如配备是这样的
[color=red] <message-resources parameter="ApplicationResources" key="myAppRes"/> [/color]
如果只有一个带key的资源文件,那就会抛出 org.apache.struts.action.MESSAGE错误了,删除key即可。[color=red][/color]