Error resolving template “pages”, template might not exist or might not be accessible by any of the

Posted 路在脚下丶

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Error resolving template “pages”, template might not exist or might not be accessible by any of the 相关的知识,希望对你有一定的参考价值。

application.properties配置文件

spring.thymeleaf.prefix=classpath:/templates/

spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
#spring.thymeleaf.encoding=UTF-8
#spring.thymeleaf.content-type=text/html # ;charset=<encoding> is added

spring.thymeleaf.cache=false

 

 

在使用springboot的过程中,如果使用thymeleaf作为模板文件,则要求HTML格式必须为严格的html5格式,必须有结束标签,否则会报错!解决办法如下:

1、你可以使用严格的标签,也就是每个标签都有结束标签,这种可能比较麻烦

2、在application.properties中增加spring.thymeleaf.mode=LEGACYHTML5,即声明thymeleaf使用非严格的html。

maven依赖如下

  <dependency>

     <groupId>net.sourceforge.nekohtml</groupId>

  <artifactId>nekohtml</artifactId>

  <version>1.9.22</version>

</dependency>

 现在就可以正常访问了。

 

 

转自:https://blog.csdn.net/diandiandelphi/article/details/72870097




以上是关于Error resolving template “pages”, template might not exist or might not be accessible by any of the 的主要内容,如果未能解决你的问题,请参考以下文章

Thymeleaf org.thymeleaf.exceptions.TemplateInputException: Error resolving template [xxx]

Error resolving template [xxx], template might not exist or might not be exist

报错Error resolving template template might not exist or might not be accessible解决方案

解决Error resolving template template might not exist or might not be accessible问题

异常:Error resolving template "xxx", template might not exist or might not be accessible...解

springboot报 org.thymeleaf.exceptions.TemplateInputException: Error resolving template "succeed&