我是靠谱客的博主 谦让指甲油,最近开发中收集的这篇文章主要介绍Eclipse 导入项目出错一.报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

这次多次配置tomcat后,两次分别出现了不同的红色提示,最后发现都是环境没有配置好,总结下两个错误

一.报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path。原来Javaweb工程类中没有添加Tomcat运行时相关类导致。
解决方法:配置server
1、右击web工程-》属性或Build Path-》Java Build Path->Libraries-> Add Libray...->Server Runtime -》Tomcat Server
2、切换到Java Build Path界面中的Orader and Export,选择Tomcat。
注意:
按以上方法操作时,若打开Server Runtime后一片空白,需要设置Apache服务器。设置方法为:window->Preferences->Server->Runtime Environment -> add --> 选择Apache的版本后点Next,再填入你apache服务器软件的安装(解压后)地址。

二.<%String path=request.getContextPath(); %>报错

报错:“The method getContextPath() from the type HttpServletRequest refers to the missing type String”

解决方式:配置jre

具体操作:

    1. 右击该项目 - Build Path - Configure Build Path , 在 Libraries 选项下,会发现有个出错的jre Libraries,将其Remove掉。

    2. 然后右击该项目 - Build Path - Add Library, 选择JRE System Library,选择Workspace defaulr JRE(jdk1.6)(此前JDK已成功安装并配置好), 然后 Finish.



最后

以上就是谦让指甲油为你收集整理的Eclipse 导入项目出错一.报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path的全部内容,希望文章能够帮你解决Eclipse 导入项目出错一.报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(85)

评论列表共有 0 条评论

立即
投稿
返回
顶部