新建个项目,显示long类型字段的时候报错:Cannot find message resources under key org.apache.struts.action.MESSAGE
下面方法可以解决:
在struts-config.xml中添加如下的配置:
<message-resources parameter="ApplicationResources"/>
如果出现“Cannot find message resources under key org.apache.struts.action.MESSAGE”,是说明未找到ApplicationResources.properties,要注意三方面设置。
第一:在web.xml适当位置要有如下设置:
另外说明,你也能把ApplicationResources.properties放到classes目录下其他目录,同时修改struts-config.xml中的对应设置。例如:
将“ApplicationResources.properties”放入WEB-INF\classes\test目录下。struts-config.xml中的对应设置:
第一:在web.xml适当位置要有如下设置:
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<message-resources parameter="ApplicationResources"/>
第三:确保ApplicationResources.properties文件在你建立的WEB-INF\classes目录中,而且其中有关于index.title的设置(当然,以你要提取的key名称为准)。另外说明,你也能把ApplicationResources.properties放到classes目录下其他目录,同时修改struts-config.xml中的对应设置。例如:
将“ApplicationResources.properties”放入WEB-INF\classes\test目录下。struts-config.xml中的对应设置:
<message-resources parameter="test/ApplicationResources"/>