找不到Spring Boot JSP [英] Spring Boot JSP not found

查看:86
本文介绍了找不到Spring Boot JSP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Spring Boot应用程序中,我从Thymeleaf切换到JSP,并且在我的本地计算机上正常运行,但是当我将其上传到Heroku服务器时,我得到了
There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/home.jsp

in my Spring Boot app I switched from Thymeleaf to JSP and it is working normally on my local computer, but when I upload it to Heroku server I get
There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/home.jsp

它的jar被打包了,如果它在本地工作但不能在Heroku服务器上工作,那是什么意思?

its jar packaged, what does it mean if its working locally but not on Heroku server?

编辑,项目结构

推荐答案

尝试将其添加到pom.xml:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>

并将其添加到application.properties:

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

并将JSP移至src/main/webapp/WEB-INF/jsp.

这篇关于找不到Spring Boot JSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆