Struts 1:在哪里放置消息资源的属性文件

时间:2011-03-11 16:06:16

标签: java struts

我从struts获取NullPointerError,相应的堆栈跟踪如下:

PropertyMessa W org.apache.struts.util.PropertyMessageResources loadLocale   Resource org/apache/struts/action/ActionResources_en_US.properties Not Found.
PropertyMessa W org.apache.struts.util.PropertyMessageResources loadLocale   Resource org/apache/struts/action/ActionResources_en.properties Not Found.
RequestUtils  E org.apache.struts.util.RequestUtils createActionForm Error creating form bean of class com.teig.territorymaint.web.TerritoryForm
at org.apache.struts.config.FormBeanConfig.createActionForm(FormBeanConfig.java:289)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:254)
at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:208)
at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:319)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:192)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

我不明白为什么Struts试图从apache struts包路径中获取属性文件,我怀疑我的struts配置是错误的:

<message-resources parameter="ApplicationResources" null="false" />

然后,我修改了消息资源标记,我得到了同样的错误:

<message-resources parameter="myPackagePath.ApplicationResources" null="false" />

我做错了什么?提前谢谢。

1 个答案:

答案 0 :(得分:0)

Jörn是对的;问题不是由缺少的资源文件引起的,而是我在struts配置文件中的错误的form-b​​ean类型属性

  <form-bean name="territoryAddForm"
         type="com.teig.territorymaint.web.forms.TerritoryForm">
         <!-- package path was incorrect -->
</form-bean>