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. ...
随机推荐
- C#3.0新增功能10 表达式树 02 说明
连载目录 [已更新最新开发文章,点击查看详细] 表达式树是定义代码的数据结构. 它们基于编译器用于分析代码和生成已编译输出的相同结构.表达式树和 Roslyn API 中用于生成分析器和 Cod ...
- 学习LayUI时自研的表单参数校验框架
开发背景&痛点:每次写前端的表单的时候需要对表单里用户填写的内容进行校验,减少服务器压力,提前对已知错误对用户提示.每次会要写很多的if else等等对输入框中的内容进行判断,并对为空.格式不 ...
- NLP(十二)依存句法分析的可视化及图分析
依存句法分析的效果虽然没有像分词.NER的效果来的好,但也有其使用价值,在日常的工作中,我们免不了要和其打交道.笔者这几天一直在想如何分析依存句法分析的结果,一个重要的方面便是其可视化和它的图分析 ...
- Appium自动化测试环境搭建
前言 Appium是一个开源的自动化测试框架,支持跨平台,支持多种编程语言,可用于原生,混合和移动web应用程序,使用webdriver驱动ios,android应用程序.那么为了学习app自动化测试 ...
- SpringBoot底层原理及分析
一,Spring Boot简介 1.什么是Spring Boot: SpringBoot是由Pivotal团队提供的框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程. 该框架使用了特 ...
- AI中台——智能聊天机器人平台的架构与应用(分享实录)
内容来源:宜信技术学院第3期技术沙龙-线上直播|AI中台——智能聊天机器人平台 主讲人:宜信科技中心AI中台团队负责人王东 导读:随着“中台”战略的提出,目前宜信中台建设在思想理念及架构设计上都已经取 ...
- Java Lambda表达式forEach无法跳出循环的解决思路
Java Lambda表达式forEach无法跳出循环的解决思路 如果你使用过forEach方法来遍历集合,你会发现在lambda表达式中的return并不会终止循环,这是由于lambda的底层实现导 ...
- 死磕JVM之类中各部分的加载顺序
话不多说,直接上代码: 1.通过new创建对象实例: 2.当对象中含有静态方法,且调用时: -- 调用父类静态方法: 总结: * 类中静态资源首次加载的时间是类中静态资源第一次被调用的时候或者该类的对 ...
- 使用webstorm调试node.js
折腾半天,还是webstorm顺手,但也遇到一些小问题. 1.代码补全问题 nodeJS自身的补全 File->Project Setting->JavaScript->Librar ...
- JavaScript循环出现的问题——用闭包来解决
在for循环中,数组长度为3,我本来是想对每个循环的元素绑定一个点击事件的,结果点击后控制台输出全部为1. for (var i = 0; i < data.data.length; i++) ...