找不到Spring Boot JSP

时间:2017-08-14 22:50:02

标签: spring jsp heroku spring-boot

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

它的jar包装,如果它在本地工作但在Heroku服务器上不起作用是什么意思?

编辑,项目结构 enter image description here

1 个答案:

答案 0 :(得分:1)

尝试将此添加到 <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

src/main/webapp/WEB-INF/jsp

将JSP移至12-08-2017_14:52:21 Temp: 28.9 pH: 7.670 12-08-2017_14:52:42 Temp: 28.9 pH: 7.672 12-08-2017_14:53:03 Temp: 28.9 pH: 7.672 12-08-2017_14:53:24 Temp: 8.91 pH: 7.667 12-08-2017_14:53:45 Temp: 28.9 pH: 7.667 12-08-2017_14:54:06 Temp: 28.9 pH: 7.669 12-08-2017_14:54:27 Temp: 28.9 pH: 7.671