仅一个文件的 jsp 导入错误:httpclient 无法解析
<%@page import="org.apache.commons.httpclient.HttpClient" %>
导致:“导入org.apache.commons.httpclient无法解析”
我正在使用STS(springframework)添加JSP文件,同一项目的同一目录中有2个jsp文件使用与上面相同的导入语句。 其中一个没问题,另一个出现错误,这会致命。为什么我会收到错误? STS 重启,maven clean,...,我还能做什么?
依赖项是手动添加的,如下所示,框架由 spring Roo 初始化。
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0-beta2</version>
</dependency>
顺便说一下,我从 apache.org 找到了以下信息:“Commons HttpClient 项目现已结束,不再开发。它的 HttpClient 和 HttpCore 模块已被 Apache HttpComponents 项目取代,它提供了更好的性能和更大的灵活性。”但是在检查了他们的示例代码之后,他们使用了与我相同的导入语句,如上所示。
<%@page import="org.apache.commons.httpclient.HttpClient" %>
leads to: "The import org.apache.commons.httpclient cannot be resolved"
I am using STS (springframework) to add JSP files, there are 2 jsp files in same directory of a same project use the same import statement as above. One of them is okay, another get error, this kills. Why I get the error? STS restart, maven clean, ..., and what's more can I do?
The dependency was added by hand as the follows, the framework is initialed by spring Roo.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0-beta2</version>
</dependency>
By the way, I found this information from apache.org: "The Commons HttpClient project is now end of life, and is no longer being developed. It has been replaced by the Apache HttpComponents project in its HttpClient and HttpCore modules, which offer better performance and more flexibility. " But after checking their sample codes, they use same import statement as mine, shown above.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,这被称为 HttpClient 3 .x。
事实上,这被称为 HttpClient 4.x可以在此主页上找到。
根据您的 Maven 声明,您正在使用 HttpClient 4.x,因此您应该查看HttpClient 4.x示例代码 >。您会看到它说:
Here's the HttpCient 4.x javadoc< /a>.请注意,您在 Maven 依赖项中引用了早期测试版。我建议选择一个更新且稳定的。
Indeed, that was known as HttpClient 3.x.
Indeed, that is known as HttpClient 4.x and is available at this home page.
According to your Maven declatation, you're using HttpClient 4.x, so you should check the sample codes of HttpClient 4.x. You'll see that it says among others:
Here's the HttpCient 4.x javadoc. Note that you're referencing an early beta version in your Maven dependency. I'd suggest to pick a more recent and stable one.