Struts 1:在哪里放置消息资源的属性文件
我从 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" />
我做错了什么?提前致谢。
I am getting a NullPointerError from struts, and the corresponding stack trace is the following:
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)
I don't understand why Struts is trying to fetch the properties file from the apache struts package path, and I suspected that my struts configuration is wrong:
<message-resources parameter="ApplicationResources" null="false" />
Then, I modified the message resources tag, and I got the same error:
<message-resources parameter="myPackagePath.ApplicationResources" null="false" />
What am I doing wrong? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
约恩是正确的;问题不是由缺少资源文件引起的,而是我在struts配置文件中的form-bean type属性不正确造成的
Jörn is correct; the problem was not caused by the missing resource files, but my incorrect form-bean type attribute in struts configuration file