thymeleaf

使用thymeleaf需要导入依赖

<!--thymeleaf-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-java8time</artifactId>
        </dependency>

html需要放在templates目录下

public static final String DEFAULT_PREFIX = "classpath:/templates/";

public static final String DEFAULT_SUFFIX = ".html";

在html的第二行一定要加上这个

<html lang="en" xmlns:th=http://www.thymeleaf.org>

写地址是@{}

写数据是${}

一起学java 文章被收录于专栏

分享平时学习心得及见解,还有学习笔记

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务