I have a project created by Maven integration in Eclipse. All work fine, but in the work space in all JSP files have this:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
To the first string where place:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
When I create a basic dynamic web project and JSP in - all is fine, no errors.
Project → Properties → Target Runtimes → Apache Tomcat worked for me. There is no Target Runtimes under Facets (I'm on Eclipse v4.2 (Juno)).
In case of JBoss... right click on project → Build Java path → add external JAR files.
Then browse to jboss-folder → Common → lib → servlet-api.jar
. . Click OK, refresh the project, and run it...
Adding the Tomcat server in the server runtime will do the job:
Project Properties → Target Runtimes → Select your Server from the list, "JBoss Runtime" → Finish
In case of Apache you can select Apache Runtime.
Select project → Properties → Project Facets → Target Runtimes → VMware Server.
It worked for me.
If you are not using Maven, just drop the javax.servlet-api.jar in your project lib folder.
Adding the Tomcat server in the server runtime will do the job:
Project properties → Java Build Path → Add Library → Select "Server Runtime" from the list → Next → Select "Apache Tomcat" → Finish.