您的位置:首页 > 编程语言 > Java开发

Description Resource Path Location Type The superclass "javax.servlet.http.HttpServlet" was not foun

2020-04-15 20:06 169 查看

Description Resource Path Location Type

The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path index.jsp /SpringBootDemo/src/main/webapp line 1 JSP Problem

学SpringBoot建第一个项目遇到的小问题
问题如下:主要问题:Description Resource Path Location Type
The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path index.jsp /SpringBootDemo/src/main/webapp line 1 JSP Problem
虽说项目可以运行但是有一丢丢的我来说很是难受呀。
解决方案(去掉错误):以下步骤
在自己的项目上点击右键–>鼠标划到最下面properties进行点击

点击Add Library进去





这样问题就解决了没有了红叉叉了可以正常运行了
Application.代码块

package com.chinasoft.SpringBoot_1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;

/*把普通java类 转换成SpringBoot的框架启动类

  • 需要spring的虚拟注解 及继承web服务的父类*/
    @SpringBootApplication
    @ServletComponentScan
    public class Application extends SpringBootServletInitializer{

    /框架启动方法/
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    /用线程工具方法启动 保证单线程/
    SpringApplication.run(Application.class, args);
    }

}


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐