The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

我们在用Eclipse进行Java web开发时,可能会出现这样的错误:The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path。

The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

此时右键项目Build Path→Configure Build Path

The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path

选择Server Library 然后apply即可

The superclass javax.servlet.http.HttpServlet was not found on the Java Build Path