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 文章被收录于专栏

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

全部评论

相关推荐

2025-12-26 18:02
西南民族大学 Java
非为偏安一鱼:点评还行 但是外卖有点太捞了 建议要么爆改加点亮点,要么换个项目
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务