解决办法:错误异常The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

问题描述:我在创建maven web后,将普通web项目转换为Dynamic Web项目后,index.jsp中最顶端html中出现了The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path错误异常

原因分析:在java web工程下没有引入中间件(服务器tomcat)运行的library

解决办法

(1): 确认eclipse中server的运行环境是否有配置,设置方法为:Window → Preferences → Server → Runtime Environments →Add → 选择Apache的版本后点Next,再填入你apache tomcat软件的安装(解压后)目录。

(2): 右击web工程 → Build Path → Configure build path... → Java Build Path → Libraries → Add Libray... → Server Runtime →Next> → Apache Tomcat Server →Finish。

(3): 切换到Java Build Path界面中的Orader and Export,勾选Tomcat。

(4): 右击web工程 → 属性 → Project Facets → 点击右侧tab选择Runtimes → 勾选tomcat → OK。

解决方案来源于Stack Overflow,原文地址如下

>>>> https://stackoverflow.com/questions/22756153/the-superclass-javax-servlet-http-httpservlet-was-not-found-on-the-java-build

你可能感兴趣的:(解决办法:错误异常The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path)