Java 错误 - 找不到“/struts-tags”的标签库描述符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4050712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error - Can not find the tag library descriptor for "/struts-tags"
提问by blue-sky
I'm receiving this error on my jsp file - 'Can not find the tag library descriptor for "/struts-tags"'
我在我的 jsp 文件中收到此错误 - '找不到“/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
我正在关注教程 - 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
谢谢
采纳答案by Javi
Have you added the struts2-core-.jar to the libraries of the project? If you have try to clean the project.
你有没有将struts2-core-.jar 添加到项目的库中?如果您尝试清理项目。
回答by William
This is probably Eclipse getting a bit 'confused' rather than a genuine error.
这可能是 Eclipse 变得有点“困惑”而不是真正的错误。
I had the same thing yesterday when working through a Struts 2 tutorial, but it disappeared after opening/closing the JSPs.
昨天我在学习 Struts 2 教程时遇到了同样的事情,但在打开/关闭 JSP 后它消失了。
回答by Steven Benitez
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.
正如威廉所说,这听起来像是您的 IDE 可能不知道标签库的 TLD 在您的项目中的位置,但是一旦打包并运行,它就可以正常工作。
回答by htobon
In ECLIPSE: Right click on the project and select the option "Validate". That's all.
在 ECLIPSE 中:右键单击项目并选择“验证”选项。就这样。
回答by Tanvir
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.
这样的事情我也经历过。我正在使用 Maven 进行编译。所以,我在我的项目中禁用并重新启用了 Maven 并解决了它。
回答by atom217
add struts2-core-.jar to the project
将 struts2-core-.jar 添加到项目中
download it here
在这里下载
回答by Nirmal Mangal
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.
1.选择项目并右键单击。2.点击属性。3.单击库选项卡。4.单击“添加罐子”。5.为您的错误添加相关的jar。
hope this helps. Thanks.
希望这可以帮助。谢谢。
回答by lory105
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 into WEB-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!!
我遇到了这个问题,因为我手动将库直接复制到WEB-INF/lib
项目的文件夹中,而 eclipse 看不到它们(我建议您WEB-INF/lib
仅通过 eclipse将任何必要的库复制到其中!)。所以只有刷新项目才能解决我的问题,因为所有其他解决方案都不起作用!!
(I'm using Eclipse Kepler unber Ubuntu)
(我正在使用 Eclipse Kepler unber Ubuntu)