错误 - 找不到“/struts-tags”的标签库描述符
我在 jsp 文件上收到此错误 - '找不到“/struts-tags”的标签库描述
符'奇怪的是我的应用程序似乎仍然可以工作。
我正在关注 - http://struts.apache.org/ 上的教程2.x/docs/using-struts-2-tags.html
这是代码。
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hello World!</title>
</head>
<body>
<h2><s:property value="messageStore.message" /></h2>
<p>I've said hello <s:property value="helloCount" /> times!</p>
<p><s:property value="messageStore" /></p>
</body>
</html>
谢谢
I'm receiving this error on my jsp file - 'Can not find the tag library descriptor for "/struts-tags"'
Strange thing is my app still seems to work.
I'm following the tutorials at - http://struts.apache.org/2.x/docs/using-struts-2-tags.html
Here is the code.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hello World!</title>
</head>
<body>
<h2><s:property value="messageStore.message" /></h2>
<p>I've said hello <s:property value="helloCount" /> times!</p>
<p><s:property value="messageStore" /></p>
</body>
</html>
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
您是否已将 struts2-core-.jar 添加到项目的库中?如果您尝试清理该项目。
Have you added the struts2-core-.jar to the libraries of the project? If you have try to clean the project.
在 ECLIPSE 中:
右键单击该项目并选择“验证”选项。就这样。
In ECLIPSE:
Right click on the project and select the option "Validate". That's all.
这可能是 Eclipse 变得有点“困惑”,而不是真正的错误。
昨天我在学习 Struts 2 教程时也遇到了同样的情况,但在打开/关闭 JSP 后它就消失了。
This is probably Eclipse getting a bit 'confused' rather than a genuine error.
I had the same thing yesterday when working through a Struts 2 tutorial, but it disappeared after opening/closing the JSPs.
同样的事情也发生在我身上。我使用Maven来编译。因此,我在项目中禁用并重新启用 Maven,问题就解决了。
The same thing happened to me. I am using Maven to compile. So, I disabled and re-enabled Maven in my project and that solved it.
我遇到了类似的问题。这就是我为解决该问题所做的事情。
1.选择项目并右键单击。
2.单击属性。
3.单击库选项卡。
4.单击“添加罐子”。
5.为您的错误添加相关jar。
希望这有帮助。
谢谢。
I faced similar problem. This is what I did to resolve the issue.
1.Select Project and right click.
2.Click on properties.
3.Click on libraries tab.
4.Click on 'Add Jars'.
5.Add relavent jar for your error.
hope this helps.
Thanks.
我遇到这个问题是因为我手动将库直接复制到项目的文件夹
WEB-INF/lib
中,而 eclipse 没有看到它们(我建议您将任何必要的库复制到WEB 中) -INF/lib
只能通过 eclipse!)。因此,只有项目的刷新才解决了我的问题,因为所有其他解决方案都不起作用!(我在 Ubuntu 上使用 Eclipse Kepler)
I had this problem because I copied the libraries manually and directly into the folder
WEB-INF/lib
of the project and eclipse doesn't see them (I suggest you copy any necessary libraries intoWEB-INF/lib
only through eclipse!). So only a refresh of the project solved the problem for me because all the other solutions didn't work!!(I'm using Eclipse Kepler unber Ubuntu)
正如 William 提到的,这听起来像是您的 IDE 可能不知道标签库的 TLD 在您的项目中的位置,但一旦打包并运行,它就可以正常工作。
As William mentioned, this sounds like your IDE may not know where the TLD for the tag library is in your project, but once packaged and running, it is working fine.
将 struts2-core-.jar 添加到项目中
,在此处下载
http://struts。 apache.org/development/2.x/index.html
add struts2-core-.jar to the project
download it here
http://struts.apache.org/development/2.x/index.html
转到“项目”选项卡 >干净的..
即使清理项目并不能清除错误,右键单击该项目并单击刷新
然后右键单击该项目,转到“属性”,“Java 构建路径”>> “订购和导出”选项卡>>确保检查 JRE 库和 Maven 依赖项。
这可能会解决它,就像它为我所做的那样
go to Project tab > Clean..
Even if cleaning the project doesn't clear the error, right-click on the project and click refresh
Then right-click on the project, go to properties, Java Build Path >> 'Order and Export' tab >> make sure JRE library and Maven dependencies are checked.
that would probably solve it as it did for me