如何解决JSP页面顶端报错 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
题目有点长,昨天刚接触jsp,按照网上的教程安装完 tomcat 和 eclipse EE 之后,新建jsp文件却出现了如下报错:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
教程没有问题,传送门:http://www.runoob.com/jsp/jsp-setup.html
下面给出问题及解决方案:
1.报错内容:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
2. 解决方案:
在 Java Build Path 中添加 tomcat 的 library,具体步骤参考该页面:http://jingyan.baidu.com/article/f79b7cb34f40569144023ef9.html,图文并茂非常详细。
3.特殊情况:
如果以上方案不能解决问题,在 jsp 页面上仍然报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
此时,我们就应该先来看一下,我们在 Java Build Path 中新添加的 library 是否如图下所示。(我安装的 tomcat 版本是 tomcat 9.0.0.M9)可以看到,Apache Tomcat v9.0 的 library 下是空的,并没有 jar 包,相当于系统并没有去 tomcat 的安装目录把 tomcat 的 lib 文件夹中的 *.jar 文件正确的添加进来。 So,只能我们自己手工导入了。
解决方案一:
因此,我们可以自己新建一个library,然后到 tomcat 的安装目录下把 tomcat 的 lib 文件夹中的 *.jar 文件全部添加进我们新建的 library 里。步骤如下。
1)打开 Java Build Path,打开 Add Library,选择 User Library,点击 Next。
2)此时进入的页面,就是用户自己建立的 library 页面了。在 User libraries 列表,可以看到用户在之前建立的 library。 点击 User Libraries 按钮。接着点击 New 按钮,建立新的library。
3)输入新 library 的名字:newLibraryForTomcat。点击 OK。
4)为 newLibraryForTomcat 配置 jar 包。①单击选中 newLibraryForTomcat ②单击 Add External JARs ,此时会弹出一个 JAR Selection 窗口,蓝色框所示是 我们安装的 tomcat 的 lib 的路径,在此路径下,使用 ctrl + A 选中所有 *.jar 文件 ③单击“打开”按钮 ④单击 OK 按钮。
此时,我们就新建了一个名为 newLibraryForTomcat 的 library。
5)接下来,我们就可以在 Java Build Path 的 Libraries 中添加我们的 newLibraryForTomcat。步骤如下 ① ② ③ ④。
6)点击 OK 按钮。完成啦。
这时候再来看看我们的 jsp 文件,页面头部的报错已经消失了。
解决方案二
之前安装的 tomcat版本是 tomcat 9.0.0.M9。后来换了一个 tomcat 8,按照第二部分的解决方案,系统就自动地去 tomcat 的安装目录把 tomcat 的 lib 文件夹中的 *.jar 文件正确的添加进来了…… 对此我也表示疑惑。不知道自己是不是在安装 tomcat 9.0.0.M9 的时候出了问题。如果有了解的同学们……烦请指点我一下,不胜感激。
OVER
如何解决JSP页面顶端报错 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path的更多相关文章
- eclipse中web工程新建jsp文件报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
web工程中新建jsp文件提示:The superclass "javax.servlet.http.HttpServlet" was not found on the Java ...
- 新建maven指定jdk版本-eclipse新建maven项目报错The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path的解决方案
具体表现为: 使用Eclipse+Maven建立了一个Javaweb工程,JSP页面顶端出现“红色”的报错信息:The superclass "javax.servlet.http.Http ...
- 新建jsp报错“The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path”
今天新建jsp文件时,就报错“Visual Page Editor has experimental support for Windows 64-bit”,然后刚好stackoverflow上面有这 ...
- [IDE - Eclipse] JSP报错:The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
是因为Eclipse的Web项目不自动引入相关jar包. Right Click on the Project ❯ Properties ❯ Project Facets. You would be ...
- 使用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 ...
- java web(jsp)-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 ...
- JSP报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
今天使用Eclipse+Maven建立了一个Javaweb工程,并在eclipse中配置了Web容器Jboss eap 6.2.新建jsp页面,添加一个简单 的Java类.可是,JSP页面顶端出现“红 ...
- JavaWeb:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
建立了一个Javaweb工程,并在eclipse中配置了Web容器Tomcat.新建的jsp页面,添加一个简单的Java类.可是,JSP页面顶端出现“红色”的报错信息:The superclass & ...
- Eclipse导入JavaWeb项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
JavaWeb项目中写的JSP页面需要Web容器解析处理成HTML才能展示到前端浏览器,解析JSP需要Web容器.JSP页面顶端出现“红色”的报错信息:The superclass "jav ...
随机推荐
- JavaWeb学习 (五)————Servlet(一)
一.Servlet简介 Servlet是sun公司提供的一门用于开发动态web资源的技术. Sun公司在其API中提供了一个servlet接口,用户若想用发一个动态web资源(即开发一个Java程序向 ...
- openssl rsautl和openssl pkeyutl(文件的非对称加密)
openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html rsautl是rsa的工具,相当于rsa.dgst的部分功能集合,可用于生成 ...
- Session会话保持机制的原理与Tomcat Session共享的几种实现方式(Session Cluster、memcached+MSM)
一.Session的定义 在计算机科学中,特别是在网络中,session是两个或更多个通信设备之间或计算机和用户之间的临时和交互式信息交换.session在某个时间点建立,然后在之后的某一时间点拆除. ...
- EF SaveChanges() 报错(转载)
最佳答案 报这个错是因为,提交了主键重复的数据,虽然未提交到数据库中 但是现在的EF上下文中已经包含了我提交的数据,下次在提交正确数据时, 原来添加到上下文中的数据依然还在..如何处理这个问题呢? ...
- mvc导出excel记录
前言: 记录这篇使用记录,是为了方便以后学习查阅和让没有使用过的人了解一下,其中不足还请见谅.不是很全的文章,大神请绕行.在项目中我们或多或少的会遇到数据导出到excel表格以便线下查看或者记录一些需 ...
- Java基础——正则表达式
一.什么是正则表达式 正则表达式,又称规则表达式.(英语:Regular Expression,在代码中常简写为regex.regexp或RE),计算机科学的一个概念.正则表通常被用来检索.替换那些符 ...
- Django Rest Framework之用户频率/访问次数限制
内置接口代码基本结构 settings.py: REST_FRAMEWORK = { 'DEFAULT_THROTTLE_CLASSES':['api.utils.mythrottle.UserThr ...
- Web应用架构入门之11个基本要素
译者: 读完这篇博客,你就可以回答一个经典的面试题:当你访问Google时,到底发生了什么? 原文:Web Architecture 101 译者:Fundebug 为了保证可读性,本文采用意译而非直 ...
- redis 集群搭建
1.redis 集群 redis集群是一个无中心的分布式redis存储架构,可以在多个节点之间进行数据共享,解决了redis高可用.可扩展等问题,redis集群提供了以下两个好处 1.将数据自动切分( ...
- 微信小程序 数组索引 data-“”解释
按照官方最新文档循环的方式,索引值是以 wx:for-index="index" 方式写的, 以 parseInt(event.currentTarget.dataset.i ...