struts中找不到键org.apache.struts.action.MESSAGE下的消息资源
我在浏览器窗口中收到以下错误:
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
我有使用将资源文件包含在 struts-config.xml 中
我的资源文件存储为 WEB-INF/classes/Application.properties 文件。
I am getting the following error in the browser window :
org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
I have included the resource file in the struts-config.xml using
And my resource file is stored as WEB-INF/classes/Application.properties file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
嗯,这是一篇旧帖子,但我想我的回答可以有所帮助......
我个人浪费了一些时间来制作一个在 Tomcat 7 下在 Tomcat 5.5 下开发的项目。
注意:您应该将您的资源文件命名为:“ApplicationResources”...
有几个原因导致它无法工作,但最重要的是我在网上找到的常见答案是:将该行放入
“struts-config.xml”中。
就我而言,这一行已经存在,而事实恰恰相反:我必须将其删除并在“web.xml”文件级别替换为
“servlet”标记中的 : 。
很抱歉,我对此没有有价值的解释,但我的应用程序现在表现得很好。
有人有(解释)吗?
Well this is an old post, but my answer can help, I guess...
I personally wasted some time to make work a poject that had been developped under Tomcat 5.5 under Tomcat 7.
Note : You should name your ressource file : "ApplicationResources"...
There is several reasons why it wouldn't work, but the most common answer I found on the net was : put the line
in your "struts-config.xml".
In my case, this line was already present, and this was the contrary : I had to remove it and replace at the "web.xml" file level by :
in the "servlet" tag.
I'm sorry that I don't have a valuable explanation for this, but my application behaves just fine now.
Does anyone has (an explanation) ?
这发生在我身上,因为我正在将项目转换为 Maven,而我的
resources
目录不正确。我有这样的 struts-config.xml:
我的 pom.xml 是这样的:
但我的
messages
文件夹位于我的项目根目录中。所以我把它移到:This happened to me because I was converting my project to maven and my
resources
directory was not correct.I had struts-config.xml like this:
My pom.xml was like this:
But my
messages
folder was in my project root. So I moved it to:确保您在 struts-config.xml 标头中使用相同版本的 DTD:
我在使用两个不同版本时遇到此错误:
//EN"
“http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd”>
修正后,Pb 就解决了:
Make sur that you are using the same version of the DTD in the header of struts-config.xml:
I had this error when using two differents versions:
//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
and the Pb was solved once the correction made:
XML 可能丢失...
您的应用程序在什么上下文中运行?雄猫?杰老板?
尝试包含 xalan 和 xerces 依赖项。
An XML might be missing...
In which context is your application running ? Tomcat ? JBoss ?
Try including xalan and xerces dependencies.
以下解决了我的问题:
在 Struts Config 中,包括:(
在顶部)
该错误似乎是由于 struts-config.xml 中缺少消息资源的路径引起的
和顶部的 DOCTYPE 定义相同。
The following solved my problem:
In Struts Config, include:
(At the top)
This error seems to be caused by a lack of a path to message-resource in struts-config.xml
and the DOCTYPE definition at the top of the same.
你应该把这一行放在你的 struts-config.xml 中
you should put this line in your struts-config.xml
就我而言,从
struts-config.xml
文件中的message-resources
元素删除所有不必要的属性后,问题得到解决。就像下面这样:In my case problem was fixed after delete all unnecessary attributes from
message-resources
element instruts-config.xml
file. Just like following: