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

时间:2021-12-09 07:23:25

httpservlet cannot be resolved to a type

?
1
2
3
4
5
6
7
8
9
10
11
12
13
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

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

可以参考:xxx cannot be resolved to a type 错误解决方法

原文链接:http://blog.csdn.net/testcs_dn/article/details/50286073