首页 > 编程语言 > 详细

Springboot 模板

时间:2020-07-20 22:15:14      阅读:86      评论:0      收藏:0      [点我收藏+]

吐槽:软化版Django

一、基本流程

1、导包

<dependency>
    <groupId>org.thymeleaf</groupId>
    <artifactId>thymeleaf-spring5</artifactId>
</dependency>

<dependency>
    <groupId>org.thymeleaf.extras</groupId>
    <artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>

2、使用

a、在templates文件夹中自定义html文件

b、在controllr层->coontroller类->方法->return "文件名"

注意:不含html

3、案例(通过这种方式设置首页)

@GetMapping("/")
public String getTestFirst(){
    return "index";
}

二、thymeleaft语法(模板语法)

1、导入约束

 xmlns:th="http://www.thymeleaf.org"
<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>

2、基础语法

参考文档

https://www.cnblogs.com/msi-chen/p/10974009.html#_label1_0

 

Springboot 模板

原文:https://www.cnblogs.com/wt7018/p/13347360.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!