首页 > 编程语言 > 详细

spring boot 2.x Path with "WEB-INF" or "META-INF"

时间:2019-03-10 21:49:37      阅读:1133      评论:0      收藏:0      [点我收藏+]

学习spring boot 2.x时,使用jsp作为前端页面。在application.properties配置了jsp所在位置

spring.mvc.view.prefix:/WEB-INF/views/
spring.mvc.view.suffix:.jsp

启动spring boot时报错,找不到页面

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sun Mar 10 21:37:47 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
 
服务器端日志输出为:
o.s.w.s.r.ResourceHttpRequestHandler     : Path with "WEB-INF" or "META-INF": [WEB-INF/views/home.jsp]
 
原因是spring boot默认不使用jsp,需要在pom中引用jsp的编译程序:


<!--jsp页面使用jstl标签 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>

<!--用于编译jsp -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>

spring boot 2.x Path with "WEB-INF" or "META-INF"

原文:https://www.cnblogs.com/chensuqian/p/10507396.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!