异常:This application has no explicit mapping for /error.以及spring.mvc.view.prefix配置解决
《Spring Boot实战派》 实例7实现MVC模式的Web应用程序 遇到的问题
Error resolving template [mvcdemo], template might not exist or might not be accessible
by any of the configured Template Resolvers] with root cause
主要原因是模板没找到,说明resource文件可能有问题
第一步:
确保启动文件的位置,这里是MvcDemoApplication,放在最外侧,和子包并列或者处于外侧,这里的子包是contrller和model ,spring-boot会自动加载启动类所在包及其子包下的所有组件
第二步:
需要配置application.properties
文件中视图解析器,笔者这一步出现错误
需要配置成如下
#配置前缀
#spring.thymeleaf.prefix=classpath:/templates/
#配置后缀
#spring.thymeleaf.suffix=.html
Thymeleaf模版默认会使用templates作为视图文件
第三步
注意@Controller中试图模板的名字和resource文件下的html文件名字相匹配。
//定义mvc中的视图模板ModelAndView modelAndView=new ModelAndView("mvcdemo");//需要和html文件名相匹配
第四步
确保@GetMapping("/mvcdemo")
和控制器url访问路径一致
参考博客SpringBoot—静态页面加载
参考博客异常:This application has no explicit mapping for /error, so you are seeing this as a fallback.
异常:This application has no explicit mapping for /error.以及spring.mvc.view.prefix配置解决相关推荐
- 异常:This application has no explicit mapping for /error, so you are seeing this as a fallback.
初学springboot配置好文件,测试接口出现这个是springboot的启动器要放在dao service-包的上层目录
- SpringBoot This application has no explicit mapping for /error, so you are seeing this as a fallback
文章目录 SpringBoot This application has no explicit mapping for /error, so you are seeing this as a fal ...
- 异常:This application has no explicit mapping for /error, so you are seeing this as a fallback解决方法
目录 一.错误提示: 二.原因: 三.解决方法1,移动控制层的包: 四.解决方法二,添加@SpringBootApplication(scanBasePackages="controlle ...
- spring,Whitelabel Error Page,This application has no explicit mapping for /error, so you are seeing
This application has no explicit mapping for /error, so you are seeing this as a fallback. @RestCont ...
- P16对member进行代码生成时,访问端口出现This application has no explicit mapping for /error, so you are seeing this
P16时,当对member进行代码生成时,访问端口出现This application has no explicit mapping for /error, so you are seeing th ...
- 解决:Whitelabel Error Page This application has no explicit mapping for /error...UnknownHostException
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1. 我的情况 : springcloud 实践,启动 ribbon 工程后,请求接口报错: Whi ...
- 查询商品列表报错This application has no explicit mapping for /error, so you are seeing this as a fallback
1.问题: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing t ...
- 当出现Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as ...
- 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 /erro ...
最新文章
- 卡尔曼滤波器的特殊案例
- Hive JDBC:Permission denied: user=anonymous, access=EXECUTE, inode=”/tmp”
- gitlab修改配置重启_centos7下gitlab安装说明
- JMS : Java Message Service (Java消息服务)之一 [转]
- 工作182:表格渲染
- HTML5 基础知识
- node.js的下载和安装
- Requests库常用方法及其详解
- 【Django 2021年最新版教程1】windows10+python3.9.5+pycharm2021.1.1+Django3.2.3新建一个web项目 教程
- matplotlib绘制横向柱状图
- 澳大利亚IT解决方案提供商使用OpManager节省了数万美元的IT维护成本
- 火电厂给水串级控制系统仿真
- c语言计算矩阵的n次方,N矩阵的n次方运算及折半查找报告--数据结构(C语言)
- flickr网站用到的php技术
- Reducing Language Biases in Visual Question Answering with Visually-Grounded Question Encoder 论文笔记
- 计算多边形中心点坐标的方法
- 为什么Word字间距异常的大?怎么修正排版?
- 聚合资金托管+支付 联动优势推出房产行业线上产品“海金居”
- 【OriginPro使用】FFT绘制信号频谱图
- 【智能优化算法】基于矮猫鼬优化算法求解单目标优化问题附matlab代码