zoukankan      html  css  js  c++  java
  • springboot使用thymeleaf 解析异常


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

      1、你可以使用严格的标签,也就是每个标签都有结束标签,这种可能比较麻烦
      2、在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
    spring.thymeleaf.cache=false

      即声明thymeleaf使用非严格的html。启动之后访问页面会报如下错误:

      

    org.thymeleaf.exceptions.ConfigurationException: Cannot perform conversion to XML from 
    
    legacy HTML: 
    The nekoHTML library is not in classpath. nekoHTML 1.9.15 or newer is required for 
    
    processing templates in
    "LEGACYHTML5" mode [http://nekohtml.sourceforge.net]. Maven spec: 
    
    "net.sourceforge.nekohtml::nekohtml::1.9.15".
    IMPORTANT: DO NOT use versions of nekoHTML older than 1.9.15.

      上面的异常说的是需要依赖nekoHTML 1.9.15 or newer的版本。pom.xml中添加依赖如下

    <dependency>
        <groupId>net.sourceforge.nekohtml</groupId>
        <artifactId>nekohtml</artifactId>
        <version>1.9.22</version>
    </dependency>

      

  • 相关阅读:
    MPLS TE 知识要点
    MPLS TE CBR仲裁法则仲裁法则
    MPLS TE CBR仲裁法则Administrate-weight
    MPLS TE CBR仲裁法则亲和值及接口属性标记
    影响CBR为TE选择tunnel建立路径的因素
    Micro LED 技术详谈
    准分子激光概述
    激光讨论
    PI膜热作用机理
    激光作用的物理过程
  • 原文地址:https://www.cnblogs.com/QW-lzm/p/8275537.html
Copyright © 2011-2022 走看看