天天看點

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

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

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

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

在自己電腦上找到servlet-api.jar并将其copy到相應項目的WebContext/WEB-INF目錄下的lib 檔案夾下即可完美解決~

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