Reputation: 13526
<%@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.
Upvotes: 1
Views: 2375
Reputation: 1108852
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."
Indeed, that was known as HttpClient 3.x.
"It has been replaced by the Apache HttpComponents project in its HttpClient and HttpCore modules, which offer better performance and more flexibility."
Indeed, that is known as HttpClient 4.x and is available at this home page.
But after checking their sample codes, they use same import statement as mine, shown above.
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:
import org.apache.http.client.HttpClient;
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.
Upvotes: 3