首页 > 代码库 > The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files

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页中选择Add external Jars...按钮。server runtime --》next---》选择你要选用的tomcat即可
问题解决了。
网上别的方法(我没有尝试过):
1.工程右键-properties->java build path
2.在java build path的libraries tab页中选择Add external Jars...按钮

3.选择eclipse的安装目录,他的是绿色版本,他本机的路径如下,你自己需要根据自己的路径查找添加。E:\eclipse-java-indigo-SR1-win32\eclipse\plugins 选择javax.servlet.jsp_2.0.0.v201101211617.jar;javax.servlet_2.5.0.v201103041518.jar 进行添加即可 注释:由于版本不同,文件包名可能稍有区别。
 
 

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