Error:

The import javax.servlet cannot be resolved

The import javax.servlet.http.HttpServletRequest cannot be resolved

Description:

我们经常会把别人的项目copy到自己这里进行二次开发或者参考,有的时候会发生上面的错误,

即eclipse项目里我们导入的项目里提示HttpServletRequest 不能引用,会伴随头疼的小红叉出现。

Accuse:

具体原因是我们工程里面web-inf/lib目录下少了相应的包:Package javax.servlet.http引起的;

通俗且确切的讲就是缺少TOMCAT_HOME\lib下的servlet-api.jar

我导入别人的项目,在别人的机器上他配置了Server,一般都是tomcat,而在拷贝的过程中Server的那些library是不会随项目一起拷贝过来的,除非别人把tomcat的library已经拷贝到WEB-INF\lib下了。

Action:

Project -> Properties -> Java Build Path -> Add Library -> Server Runtime -> next -> 选择你的Server -> Finish

第一次写java遇到的第一个问题。呵呵

项目导入时报错:The import javax.servlet.http.HttpServletRequest cannot be resolved的更多相关文章

  1. 在Myeclipse buildpath 加server lib (server runtime)/项目导入时报错:The import javax.servlet.http.HttpServletRequest cannot be resolved

    来源于:http://blog.csdn.net/dingqinghu/article/details/8805922 http://yl-fighting.iteye.com/blog/140946 ...

  2. 项目导入时报错:The import javax.servlet.http.HttpServletRequest cannot be resolved 解决方法

    Error: The import javax.servlet cannot be resolved The import javax.servlet.http.HttpServletRequest ...

  3. The import javax.servlet.http.HttpServletRequest cannot be resolved

    Error: The import javax.servlet cannot be resolved The import javax.servlet.http.HttpServletRequest ...

  4. The import javax.servlet.jsp.JspException cannot be resolved

    问题描述   重新更换了 Apache Tomcat 的版本,在 Eclipse 中项目报错信息:The import javax.servlet.jsp.JspException cannot be ...

  5. 编译时提示软件包 javax.servlet.http 不存在 import javax.servlet.http.HttpServletRequest;

    编译时错误:软件包 javax.servlet.http 不存在import javax.servlet.http.HttpServletRequest; 解决办法:把servlet-api.jar加 ...

  6. The type javax.servlet.http.HttpServletRequest cannot be resolved.

    The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from ...

  7. 使用maven创建项目时报错The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    Description Resource Path Location Type The superclass "javax.servlet.http.HttpServlet" wa ...

  8. [spring]启动时报错:NoSuchMethodError: javax.servlet.http.HttpServletResponse.getStatus()I

    Spring V4.1以后的版本在不支持Servlet3.0的应用服务器上跑时会报如下错误: NoSuchMethodError: javax.servlet.http.HttpServletResp ...

  9. The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files

    我的方法:是缺少servlet的引用库,解决如下 1.工程右键-properties->java build path 2.在java build path的libraries tab页中选择A ...

随机推荐

  1. margin与padding大比拼

    用margin还是用padding这个问题相信是每个学css的人都想要去深入了解的. CSS边距属性定义元素周围的空间.通过使用单独的属性,可以对上.右.下.左的外边距进行设置.也可以使用简写的外边距 ...

  2. spring-开发需要jar包

    需要的开发包 Spring核心开发包: Commons-logging.jar Spring-beans.jar Spring-context.jar Spring-core.jar Spring-e ...

  3. Springcloud Eureka 启动失败:ERROR org.springframework.boot.SpringApplication - Application run failed

    在测试Euruka作为服务注册中心的时候碰到了这个问题 [main] ERROR org.springframework.boot.SpringApplication - Application ru ...

  4. Xtrabackup实现MySQL备份

    一.xtrabackup介绍 Xtrabackup是一个对InnoDB做数据备份的工具,支持在线热备份(备份时不影响数据读写)它由percona提供的mysql数据库备份工具,据官方介绍,这也是世界上 ...

  5. Linux基础知识随笔记

    linux文件属性 ls -h human-readable以人类可读的形式显示 -i 显示inode号码 [root@oldboyedu55-bjb ~]# ls -ihl total 8.0K 3 ...

  6. 如何设置 html 中 select 标签不可编辑、只读

    转载自: https://blog.csdn.net/hjm4702192/article/details/33729767 1. <select style="width:195px ...

  7. vue学习--父子组件通讯

    this.$parent        // 子组件访问父组件 this.$root            // 访问根实例 this.$children        // 父组件的所有子元素 *一 ...

  8. hive连接MySQL报错

    错误如下: [root@awen01 /usr/local/apache-hive-1.2.1-bin]#./bin/hive Logging initialized using configurat ...

  9. 【机器学习算法基础+实战系列】SVM

    概述 支持向量机是一种二分类模型,间隔最大使它有别于感知机.支持向量机学习方法由简至繁的模型:线性可分支持向量机(linear support vector machine in linearly s ...

  10. 在庫購買管理(MM)

    ■購買管理■ [購買依頼]ME51N: 登録ME52N: 変更ME53N: 照会 [購買発注]ME21N: 登録ME22N: 変更ME23N: 照会 [見積依頼]ME41: 登録ME42: 変更ME4 ...