There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/index.j


SpringBoot集成JSP时遇到如下问题:

There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/index.jsp。

项目结构如下:

解决方法:

1、首先确认下maven中是否有如下依赖:

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
没有的话,先引入,重新启动,如果问题还没有解决,可以尝试后面的方法。

2、查看项目target目录下是否有自己编写的jsp文件

如果没有的话,有如下2种方法解决:

2.1 可以修改下配置:Edit Configarations..., 修改Working directory为:$MODULE_WORKIG_DIR$。

2.2  pom中加入bulid配置

    <build>
        <resources>
            <resource>
                <directory>src/main/webapp</directory>
                <targetPath>META-INF/resources</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>
————————————————
版权声明:本文为CSDN博主「奕奕星空」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/angellee1988/article/details/112756113

0 条评论

当前评论已经关闭


登录用户头像