简体   繁体   中英

Spring Boot JSP not found

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

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

edit, project structure在此处输入图片说明

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM