Why import javax Error in servlet. *?
•
Java
I'm using java se 6 and eclipse with an error in the line
import javax.servlet.*
This import does not appear to have a jar
How? Install anything, use eclipse EE or add some dependencies in Maven?
Solution
The servlet API is not part of the JDK, you need to create a servlet API for POM XML adds an additional dependency
If this is for webapp, you can add this dependency using the scope provided, and the servlet container will make these classes available to your webapp at deployment time
<dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码