• Eclipse中新建Maven Web项目报错:The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path


    在maven web项目中的index.jsp中的错误信息如下: 

    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

    从错误信息可以看出来,找不到该类,也就是说找不到相应jar包。

    所以解决方法就是引用相应jar包即可。

    前提:

    需要设置Server Runtime,

    Window -> Perferences -> Server -> Runtime Environments -> Add -> Apache Tomcat ... , 这样一步步做下去即可。

    此问题解决方法:

    工程右键 -> Build Path -> Configure Build Path -> Libraries -> Add Library -> Server Runtime -> 选择通过上面上面步骤添加的server即可, 最后点击Apply。

    就可以看到jsp页面上的错误消失。

    但是你还会发现,工程上有一个小红叉,解决如下:

    首先查看Markers信息 (Window–>show veiw–>Markers)

    错误信息是: 

    Project configuration is not up-to-date with pom.xml. Select: Maven->Update Project... from the project context menu or use Quick Fix. 

    按提示步骤做即可解决问题!(工程右键 -> Maven -> Update Project)

  • 相关阅读:
    String和StringBuilder和StringBuffer
    多态
    组件
    反向代理
    基础知识
    reflection
    v-model 与 v-bind:model
    tomcat端口占用问题
    socket
    简要概括内存机制
  • 原文地址:https://www.cnblogs.com/FocusIN/p/7897035.html
Copyright © 2020-2023  润新知