1. 程式人生 > >HttpServletRequest cannot be resolved to a type The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

HttpServletRequest cannot be resolved to a type The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

HttpServletRequest cannot be resolved to a type


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

解決辦法:

這是因為專案中缺少兩個包 Jsp-api與servlet-api 包  在tomcat的安裝檔案中可以找到,匯入到專案中即可:

在專案的中匯入tomcat中的這兩個包

 

如果還報錯誤那可能是專案中沒有匯入jdk包 匯入即可解決