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

  1. 问题描述:使用Eclipse进行Web开发的时候,可能会出现这种错误:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path.导致这个问题的原因其实是没有引入服务器所运行时需要的library
  2. 解决方案:
    2.1 选中项目,右键选择
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
    2.2 切换到Libraries菜单下,选择Add Library
    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
    2.3 选择图中勾选项,点击下一步
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
    2.4 选择自己的服务器
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
    2.5 最后点击右下角的Apply and Close,发现报错信息不存在了
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path