springboot报 org.thymeleaf.exceptions.TemplateInputException: Error resolving template "succeed";
--------------------- 本文转自 林晓风 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/Lin_xiaofeng/article/details/79122053
1. 在controller层请求处理完了返回时,没有使用@RestController或@ResponseBody而返回了非json格式
这种情况下返回的数据thymeleaf模板无法解析,直接报错,本人正式因为这个原因才报错。
解决方案:可以将@Controller换成@RestController,不过需要注意有没有其他的方法返回了html页面,会导致返回的不是页面而是字符串;最好的方法就是在你所请求的方法上面加一个@ResponseBody即可。
2. 在你的controller层对应的方法返回html路径及名称时,在前面多加了一个/ 。
例如return "/index",正式这个/导致报错的,解决:去掉返回前面的/即可,例如return "/index" 。
3. 在使用springboot的过程中,如果使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错。
解决办法如下:
在application.yml中添加以下配置
spring.thymeleaf.content-type: text/html
spring.thymeleaf.cache: false
spring.thymeleaf.mode: LEGACYHTML5
再在pom.xml 添加以下依赖
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
4. 资源文件的路径被修改,如果你其他的请求都正常返回则可忽略这条。
解决:在pom.xml文件的<build></build>中加入.
<resource>
<directory>src/main/resources</directory>
</resource>
springboot报 org.thymeleaf.exceptions.TemplateInputException: Error resolving template "succeed";的更多相关文章
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template 报错
org.thymeleaf.exceptions.TemplateInputException: Error resolving template报错 遇到二次,第一次是刚刚学的时候,都是一个原因,而 ...
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/ template might not exist or might not be accessible by any of the configured
异常现象:在本地打包部署完全没有问题,资源文件也都可以映射上,但是打包成jar包部署到服务器上时,就一直报异常,异常信息如下: 严重: Servlet.service() for servlet [d ...
- org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/home/index2", template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/home/index2", ...
- Thymeleaf 模板使用 Error resolving template "/home", template might not exist or might not be accessible by any of the
和属性文件中thymeleaf模板的配置相关 1.配置信息 spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix= ...
- spring boot + thymeleaf 报错 org.thymeleaf.exceptions.TemplateInputException
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "admin/verifyPassword ...
- spring boot 使用thymeleaf模版 报错:org.thymeleaf.exceptions.TemplateInputException
错误: org.thymeleaf.exceptions.TemplateInputException: Error resolving template "Hello", tem ...
- Error resolving template,template might not exist or might not be accessible by any of the configured Template Resolvers
template might not exist or might not be accessible by any of the configured Template Resolvers at o ...
- exception processing, template error resolving template
错误信息:Exception processing template “/view/df”: Error resolving template “/view/df”, template might n ...
- Error resolving template [xxx], template might not exist or might not be exist
Springboot+thymeleaf+mybatis 抛Error resolving template [xxx], template might not exist的异常 原因是我们在pom. ...
随机推荐
- 7月新的开始 - LayUI的基本使用 - 分页
LayUI 分页处理 数据展示是以表格的形式展示的.使用模块如下: 首先使用内置模块-数据表格 然后使用内置模块-分页 官方文档地址:https://www.layui.com/doc/ 官方示例地址 ...
- JS+Jquery自定义格式导出HTML为Word(下列插件同样可以用于Excel导出)
这里的word导出主要采用了jquery.wordexport.js.FileSaver.js,做功能之前我也是找了很多网上的资料,里面涉及到js导出word的用的都是这个插件,只是在自定义样式这一块 ...
- .NET 欢乐编程术之类型超级转换之术👍👍
准备工作:先确保 VS 版本大于 2017,且支持C# 7.0 语言版本.然后新建 .Net Core 项目,在 Nuget 包管理上引入微软霸霸官方包 System.Runtime.Compiler ...
- C++里long的字节数
标准规定long的大小不小于int也就是说sizeof(long)>=sizeof(int). Numerical type sizes in C (bits) Platforms \ T ...
- php--学习封装类 (一)(操作mysql数据库的数据访问)
<?php class DBDA //定义一个类 { //定义成员变量,不能直接定义,前面要加上public或者是private public $host = "localhost&q ...
- CentOS虚拟机查询jdk路径
[root@wshCentOS ~]# which java/usr/bin/java[root@wshCentOS ~]# ls -lrt /usr/bin/javalrwxrwxrwx. 1 ro ...
- EF Core懒人小技巧之拒绝DbSet
前言 最近在项目中使用EF Core的频率越来越高,当项目比较大的时候,疯狂往DbContext中加各种DbSet,你会不会特难受?如果你是一键生成的大佬,那么请忽略本文.本文旨在不写 DbSet,那 ...
- linux初学者-网卡的链路聚合篇
linux初学者-网卡的链路聚合篇 网卡的链路聚合就是将多块网卡连接起来,当一块网卡损坏,网络依旧可以正常运行,可以有效的防止因为网卡损坏带来的损失,同时也可以提高网络访问速度. 网卡的链路聚合一般常 ...
- HomeBrew 安装
HomeBrew中文地址 通过以上链接把安装地址拿到, 这个地址可能会变, 再次使用需要重新获取: /usr/bin/ruby -e "$(curl -fsSL https://raw.gi ...
- 【Python-django后端开发】logging日制配置详解!!!
官方文档请查看:https://docs.djangoproject.com/en/1.11/topics/logging/ 1. 配置工程日志,在setting.py里,如下 LOGGING = { ...