【问题标题】:Spring Boot, cannot use thymeleaf in html fileSpring Boot,不能在 html 文件中使用 thymeleaf
【发布时间】:2017-06-26 07:28:27
【问题描述】:

使用 NetBeans 8.1 的 SpringBoot maven 项目。

如果我在 src/main/resourcestemplates 文件夹中创建一个 html 文件并添加 xmlns:th=" http://www.thymeleaf.org"html 标签我有错误 Attribute with local name "xmlns:th" is not serializable as XML 1.0强>。

<html lang="en-US" xmlns:th="http://www.thymeleaf.org">
<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
    <div></div>
</body>

thymeleaf 依赖在 pom.xml 中声明并在 Dependencies 中下载。

【问题讨论】:

    标签: html spring-boot thymeleaf


    【解决方案1】:

    我正在使用以下内容,没有错误:

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> ...rest of the file content...

    【讨论】:

      【解决方案2】:

      我的定义是这样的:

      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
      

      【讨论】:

        猜你喜欢
        • 2017-11-04
        • 2020-04-07
        • 2021-02-08
        • 2018-03-01
        • 1970-01-01
        • 2017-02-25
        • 2015-06-11
        • 2017-08-03
        • 2023-04-09
        相关资源
        最近更新 更多