栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as

IDEA运行简单spingboot浏览器页面报错信息: Whitelabel Error Page

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

Tue Aug 09 17:41:51 CST 2022

There was an unexpected error (type=Not Found, status=404).

在网上试了很多种方法都不行,包括:

1、Application启动类的位置不对

2、在springboot的核心配置文件:application.yml或application.properties中关于视图解析器的配置问题: 
当pom文件下的spring-boot-starter-paren版本高时使用: 
spring.mvc.view.prefix/spring.mvc.view.suffix 
当pom文件下的spring-boot-starter-paren版本低时使用: 
spring.view.prefix/spring.view.suffix

3、控制器的URL路径书写问题 
@RequestMapping(“xxxxxxxxxxxxxx”) 
实际访问的路径与”xxx”不符合.

以上方法都不行,而且我的Application启动类的位置正确,版本正确,路径正确。后面在一个博主那里找到原因,附上大佬博客链接Spring Boot整合jsp后必须通过spring-boot:run方式启动? - SegmentFault 思否s

解决方法:

1、不用main方法启动,因为通过main方法启动无法渲染。

2、需要用mvn clean spring-boot:run(点击右侧的maven,找到运行的springboot项目,点击插件)启动,因为通过maven启动能够正常渲染jsp页面。

用mvn clean spring-boot:run 运行,成功!!

打开相应的浏览器页面

 

 

 

 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1040922.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号