1. 程式人生 > >HttpServlet cannot be resolved to a type錯誤解決方案

HttpServlet cannot be resolved to a type錯誤解決方案

HttpServlet cannot be resolved to a type報錯
這裡寫圖片描述
原因解釋:

jdk 裡不包括servlet-api.jar 這個包,此包在Tomcat 中存在

專案名–> 右鍵 –>Property–> 選擇 Java Build Pat–>h–> 選擇 Add External JARs

把servlet-api.jar 的路徑輸入即可