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

所属分类: 软件编程 / java 阅读数: 45
收藏 0 赞 0 分享

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


在文章 Java中REST API使用示例——基于云平台+云服务打造自己的在线翻译工具 中从IBM Bluemix上下载的Java示例代码,导入到Eclipse之后,出现以上错误信息!

错误原因:

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

解决办法:

1、首先要安装一下Tomcat;

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

2、Eclipse中点击Window菜单,选择Preferences


3、在左侧展开Server,选择Runtime Environment,右侧点击Add按钮


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


5、点击“Browse”按钮选择Tomcat的安装位置,选择合适的JRE版本,点击Finish按钮完成。


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

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

更多精彩内容其他人还在看

spring事务Propagation及其实现原理详解

这篇文章主要介绍了spring事务Propagation及其实现原理详解,分享了相关代码示例,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Spring Boot创建可执行jar包的实例教程

这篇文章主要介绍了Spring Boot创建可执行jar包的实例教程,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

Spring Boot集成Mybatis的实例代码(简洁版)

这篇文章主要介绍了Spring Boot集成Mybatis简洁版的教程,需要的朋友可以参考下
收藏 0 赞 0 分享

Spring Boot创建非可执行jar包的实例教程

这篇文章主要介绍了Spring Boot创建非可执行jar包的实例教程,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

spring boot jar的启动原理解析

这篇文章主要介绍了 spring boot jar的启动原理分析,非常不错,具有参考借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

SpringBoot整合UEditor的示例代码

本篇文章主要介绍了SpringBoot整合UEditor的示例代码,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享

Java线程池FutureTask实现原理详解

这篇文章主要介绍了Java线程池FutureTask实现原理详解,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

Java并发之传统线程同步通信技术代码详解

这篇文章主要介绍了Java并发之传统线程同步通信技术代码详解,分享了相关代码示例,小编觉得还是挺不错的,具有一定借鉴价值,需要的朋友可以参考下
收藏 0 赞 0 分享

java文件读写工具类分享

这篇文章主要为大家详细介绍了java文件读写工具类,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
收藏 0 赞 0 分享

使用Spring Boot集成FastDFS的示例代码

本篇文章主要介绍了使用Spring Boot集成FastDFS的示例代码,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
收藏 0 赞 0 分享
查看更多