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. Python 文件访问模式

    f = open('xxx文件', '访问模式') r    以只读方式打开文件(read).文件的指针将会放在文件的开头.默认模式. w   打开一个文件只用于写入(write).如果该文件已存在则 ...

  2. C++ 类型转换(conv.)

    隐式类型转换 总结自:隐式类型转换&算数运算符 定义:隐式类型转换是指使用了与表达式规定或当前语境不相符的类型时所进行的类型转换,但是要注意,可能会存在转换出现歧义,从而无法通过编译;一切带有 ...

  3. Smartforms 设置纸张打印格式

    在sap做一个打印报表,要先设置一个纸张打印格式,下面以工厂中常用来打印的针孔纸为例,在sap设置该纸张的打印格式,以用于报表: 1.运行事务代码SPAD:选择工具栏上的[完全管理]按钮——>选 ...

  4. Java连接数据库的一个问题

    问题描述: 利用HTML+servlet+MySQL写一个简单的登录注册案例,抛出了异常No suitable driver found for jdbc 解决方法 将mysql-connector- ...

  5. WPF Datagrid对鼠标单击进行响应,借助EventSetter

    在做的一个c#的项目中发现Datagrid没办法直接对鼠标单击进行响应, 调用MouseDown事件也需要点击某一行第二次才能响应. 所以借助EventSetter来简单的实现了一个. 界面部分的代码 ...

  6. 4、spring boot 配置文件之profile

    Profile  1.多Profile文件 我们在主配置文件编写的时候,文件名可以是 application-{profile}.properties/yml 默认使用application.prop ...

  7. Android 中的反调试技术

    比较简单的有下面这两种 调试端口检测, 23946(0x5D8A) Demo: void CheckPort23946ByTcp() { FILE* pfile=NULL; char buf[0x10 ...

  8. Sqlite客户端的使用

    打开一个数据库sqlite3 ${databaseName} 查看当前打开的数据库.database 查看当前打开的数据库中的表.table 查看指定表结构(实际输出是建表语句).schema ${t ...

  9. 04,Python网络爬虫之requests模块(1)

    引入 Requests 唯一的一个非转基因的 Python HTTP 库,人类可以安全享用. 警告:非专业使用其他 HTTP 库会导致危险的副作用,包括:安全缺陷症.冗余代码症.重新发明轮子症.啃文档 ...

  10. 如何使用malloc申请一个二位数组

    fscanf(file, "%d", &iVertexNum); // Read number of Vertices double **G = (double **)ma ...