1. 程式人生 > >Httpservlet cannot be resolved to a type的原因與解決方法~

Httpservlet cannot be resolved to a type的原因與解決方法~

Httpservlet cannot be resolved to a type,顯然是Eclipse找不到相應的包,即javax.servlet。

分析原因:JDK裡不包括servlet-api.jar 這個包,此包在Tomcat 中存在 ,如下圖所示:

在自己電腦上找到servlet-api.jar並將其copy到相應專案的WebContext/WEB-INF目錄下的lib 資料夾下即可完美解決~