Issue
I am using JavaSE6 and Eclipse, there is an error in the line
import javax.servlet.*
It seems there is no jar for this import.
How to fix it? Install anything, use Eclipse EE or add some dependency in Maven?
Solution
The servlet API is not a part of the JDK, you need to add an additional dependency to your pom.xml
.
If this is for a webapp you can add this dependency with provided
scope 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>
Answered By - Martin
Answer Checked By - David Marino (JavaFixing Volunteer)