Spring boot JSP访问页面显示Whitelabel Error Page
2017-12-12 19:25
906 查看
访问页面如下
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing
this as a fallback.
Tue Apr 21 23:16:00 EEST 2015 There was an unexpected error (type=Not
Found, status=404). No message available
网上排错方案如下:
1.检查Application启动类位置是否和所有子包同级
很像是没有读到你要访问的地址。
原因是【Application启动类放的位置不对】要将Application放在最外层,也就是要包含所有子包。
比如你的groupId是com.google,子包就是所谓的com.google.xxx,所以要将Application放在com.google包下。
请参考以下结论:spring-boot会自动加载启动类所在包下及其子包下的所有组件.
2.检查application.properties配置文件中视图路径配置项
找了一晚上,居然发现是某个配置出错了! spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp应该改为 spring.view.prefix=/WEB-INF/jsp/
spring.view.suffix=.jsp。 这充分体现了spring的默认大于配置理念
以上方案都没有解决问题
最后在staroverflow找到解决方案
Ensure that you have jasper and jstl in the list of dependencies:
The Answerer is @Biju Kunjummen
在pom.xml文件中配置jsp和jstl依赖后运行成功
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing
this as a fallback.
Tue Apr 21 23:16:00 EEST 2015 There was an unexpected error (type=Not
Found, status=404). No message available
网上排错方案如下:
1.检查Application启动类位置是否和所有子包同级
很像是没有读到你要访问的地址。
原因是【Application启动类放的位置不对】要将Application放在最外层,也就是要包含所有子包。
比如你的groupId是com.google,子包就是所谓的com.google.xxx,所以要将Application放在com.google包下。
请参考以下结论:spring-boot会自动加载启动类所在包下及其子包下的所有组件.
2.检查application.properties配置文件中视图路径配置项
找了一晚上,居然发现是某个配置出错了! spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp应该改为 spring.view.prefix=/WEB-INF/jsp/
spring.view.suffix=.jsp。 这充分体现了spring的默认大于配置理念
以上方案都没有解决问题
最后在staroverflow找到解决方案
Ensure that you have jasper and jstl in the list of dependencies:
<dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency>
The Answerer is @Biju Kunjummen
在pom.xml文件中配置jsp和jstl依赖后运行成功
相关文章推荐
- SpringBoot中jsp页面调用iframe标签报Whitelabel Error Page 错误
- SpringBoot 不显示Whitelabel Error Page
- SpringBoot 访问出错Whitelabel Error Page
- spring-boot jsp whitelabel error page问题解决
- springboot + tomcat + jsp 报Whitelabel Error Page解决方法
- Spring Boot自定义错误页面,Whitelabel Error Page处理方式
- Spring Boot自定义错误页面,Whitelabel Error Page处理方式
- spring-boot集成 jsp报whitelabel error page的问题解决
- spring boot2.0 创建 及 mvc视图映射 jsp时 Whitelabel Error Page(一)
- Whitelabel Error Page(按spring-boot官网的示例跑不起来的原因之一)
- SpringBoot接口服务处理Whitelabel Error Page
- Spring-Boot "Whitelabel Error Page" 解决方法总结
- spring boot: Whitelabel Error Page的解决方案
- spring-boot Whitelabel Error Page
- 初学Spring Boot遇到Whitelabel Error Page的解决办法
- Spring Boot : Whitelabel Error Page解决方案
- springboot常见错误——Whitelabel Error Page
- SpringBoot接口服务处理Whitelabel Error Page
- 初学 Spring boot 报错 Whitelabel Error Page 404
- 《Springboot极简教程》问题解决:Springboot启动报错 Whitelabel Error Page: This application has no explicit mapping for(转)