欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

详解 问题:HttpServlet cannot be resolved to a type

程序员文章站 2024-03-03 21:57:16
httpservlet cannot be resolved to a type descriptionresourcepathlocationtype htt...

httpservlet cannot be resolved to a type

descriptionresourcepathlocationtype
httpservlet cannot be resolved to a typesimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 15java problem
httpservletrequest cannot be resolved to a typesimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 22java problem
httpservletresponse cannot be resolved to a typesimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 22java problem
servletexception cannot be resolved to a typesimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 22java problem
the import javax.servlet cannot be resolvedsimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 5java problem
the import javax.servlet cannot be resolvedsimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 6java problem
the import javax.servlet cannot be resolvedsimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 7java problem
the import javax.servlet cannot be resolvedsimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 8java problem
the import javax.servlet cannot be resolvedsimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 9java problem


webservlet cannot be resolved to a typesimpleservlet.java/javahelloworldapp/src/main/java/wasdev/sample/servletline 14java problem

详解 问题:HttpServlet cannot be resolved to a type

在文章 java中rest api使用示例——基于云平台+云服务打造自己的在线翻译工具 中从ibm bluemix上下载的java示例代码,导入到eclipse之后,出现以上错误信息!

错误原因:

eclipse是刚刚安装的,还没有配置服务器运行环境!

解决办法:

1、首先要安装一下tomcat;

通常是下载一个zip压缩包,解压一下就可以了;

2、eclipse中点击window菜单,选择preferences

详解 问题:HttpServlet cannot be resolved to a type

3、在左侧展开server,选择runtime environment,右侧点击add按钮

详解 问题:HttpServlet cannot be resolved to a type

4、在弹出的窗口中选择你的tomcat版本

详解 问题:HttpServlet cannot be resolved to a type

5、点击“browse”按钮选择tomcat的安装位置,选择合适的jre版本,点击finish按钮完成。

详解 问题:HttpServlet cannot be resolved to a type

通过上面的步骤,上面的错误都全部解决了,如果你的项目还显示 有错误,就需要考虑其它原因了。

可以参考: