
當代碼頭<%@報這個“The superclass “javax.servlet.http.HttpServlet” was not
found on the Java Build Path”錯誤時,可能是項目沒有添加tomcat庫導緻的,解決辦法如下:
- 找到報錯的項目,右擊選擇Build Path >> Configure Build Path…
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法 - 依次選擇Java Build Path >> Libraries >> Add Library
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法 - 選擇Server Runtime,然後Next
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path錯誤解決辦法 - 選擇你建立該項目時所使用的tomcat版本,這裡我是7.0,是以選第一個,然後Finish
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錯誤解決辦法
做完以上步驟後,錯誤就消失了,項目就能正常運作了