问题
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 getThere was an unexpected error (type=Not Found, status=404).
/WEB-INF/jsp/home.jsp
its jar packaged, what does it mean if its working locally but not on Heroku server?
edit, project structure
回答1:
Try adding this to 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>
and adding this to application.properties
:
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
and moving JSPs to src/main/webapp/WEB-INF/jsp
.
来源:https://stackoverflow.com/questions/45684146/spring-boot-jsp-not-found