异常如下:
严重: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
严重: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
解决办法以下两点:
这是在struts-config.xml配置文件中没有配置ApplicationResources.properties,直接在次配置文件里配置好就可以了:
<message-resources parameter="com.mytest.struts.ApplicationResources" /> <!-- 国际化资源 -->
另外需要在web.xml配置文件中配置:<init-param> <param-name>application</param-name> <param-value>ApplicationResources</param-value> </init-param>
补充:
看到一篇文章来解决这个问题,我觉得比较好,比较完全,现在补充上:
第三:确保ApplicationResources.properties文件在你建立的WEB-INF\classes文件夹中。
可以把applicationResources.properties放到classes文件夹下其它目录,例如:
把ApplicationResources.properties放入WEB-INF\classes\mydir文件夹下。struts-config.xml中的设置必须改<message-resources parameter="mydir/ApplicationResources"/>
第四:就可能是键值的问题,struts的资源文件也是可以分多资源文件配置的,比如配备是这样的
<message-resources parameter="ApplicationResources" key="myAppRes"/>
如果只有一个带key的资源文件,那就会抛出 org.apache.struts.action.MESSAGE错误了,删除key即可。
参考链接:http://www.cnblogs.com/tjsquall/archive/2008/11/27/1342258.html