Thymeleaf使用

引入Thymeleaf

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

版本配置

<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>

添加页面
HTML页面放在classpath:/templates/路径下
thymeleaf就能自动渲染

命名空间
在HTML文档头部,导入命令空间

<html lang="en" 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>
<h1>成功!</h1>
<!--th:text 将div里面的文本内容设置为 -->
<div id="div01" class="myDiv" th:id="${hello}" th:class="${hello}" th:text="${hello}">这是显示欢迎信息</div>
<hr/>
<div th:text="${hello}"></div>
<div th:utext="${hello}"></div>
<hr/><!-- th:each每次遍历都会生成当前这个标签: 3个h4 -->
<h4 th:text="${user}"  th:each="user:${users}"></h4>
<hr/>
<h4><span th:each="user:${users}"> [[${user}]] </span>
</h4>
<form th:action="@{/upload}" method="post" enctype="multipart/form-data"><input type="file" name="file"><input type="submit"/>
</form></body>
</html>

Spring boot的Thymeleaf使用相关推荐

  1. Spring Boot 使用Thymeleaf

    2019独角兽企业重金招聘Python工程师标准>>> 1.引入thymeleaf: <dependency> <groupId>org.springfram ...

  2. 没有找到 html 模板,Spring Boot and Thymeleaf:找不到HTML模板

    我正在嘗試用Thymeleaf創建一個基於Spring Boot的應用程序.我使用PetClinic樣本作爲起點. 我的應用程序找不到一些模板.Spring Boot and Thymeleaf:找不 ...

  3. java 模板引擎_极简 Spring Boot 整合 Thymeleaf 页面模板

    点击"牧码小子"关注,和众多大牛一起成长! 关注后,后台回复 java ,领取松哥为你精心准备的技术干货! 虽然现在慢慢在流行前后端分离开发,但是据松哥所了解到的,还是有一些公司在 ...

  4. Spring Boot集成Thymeleaf模板引擎

    一.Thymeleaf 模板介绍 Spring Boot 推荐使用Thymeleaf 来代替传统开发中的JSP,那么什么是Thymeleaf 模板引擎呢?下面就来简单的介绍一下. Thymeleaf ...

  5. Spring Boot整合Thymeleaf模板引擎

    转载自 Spring Boot整合Thymeleaf模板引擎 什么是Thymeleaf Thymeleaf是一款用于渲染XML.XHTML.HTML5内容的模板引擎.类似Velocity,FreeMa ...

  6. Spring Boot和Thymeleaf:重新加载模板和静态资源,而无需重新启动应用程序

    Thymeleaf是围绕自然模板的概念设计的,该模板允许进行静态原型制作:模板逻辑不会影响用作原型的模板. 尽管这是一项很棒的技术,但您可能还希望在运行的Spring Boot应用程序中查看结果,而不 ...

  7. Spring Boot结合thymeleaf

    之前在Eclipse里写了个Spring Boot响应jsp的小demo,后来发现打成jar包导出之后找不到jsp文件了.经过在网上查阅信息与资料,发现Spring Boot对于jsp的支持其实是不好 ...

  8. Spring Boot (十五): Spring Boot + Jpa + Thymeleaf 增删改查示例

    <p>这篇文章介绍如何使用 Jpa 和 Thymeleaf 做一个增删改查的示例.</p> 先和大家聊聊我为什么喜欢写这种脚手架的项目,在我学习一门新技术的时候,总是想快速的搭 ...

  9. Spring Boot 引入 Thymeleaf 及入门使用

    目录: 引言 1.Spring Boot 引入 Thymeleaf 1.1 修改 Thymeleaf 版本 1.2 修改 Thymeleaf Layout Dialect 版本 2.Thymeleaf ...

  10. 使用Spring boot,Thymeleaf,AngularJS从零开始构建新的Web应用程序–第3部分

    在之前的博客中,我们使用Thymeleaf,Bower和Bootstrap构建了登录页面,并将其部署到了Heroku. 在此博客中,我们将介绍用于前端的AngularJS和在后端的Spring Boo ...

最新文章

  1. tensorflow从入门到放弃(三)
  2. Redis工具之Jedis
  3. 在分析了47,251个依赖关系之后,2016年排名前100的Java库
  4. 暑假集训中期测试 Problem D: 装箱问题2 (并查集)
  5. centos 6.5 yum java_Centos6.5 yum 安装jdk1.8
  6. 爱奇艺2020校招编程题汇总第一题(切方块问题)
  7. 商品列表,添加,显示
  8. js获取request参数值(javascript 获取request参数值的方法)
  9. 华为软挑2019总结
  10. C# 图片反色处理 图片夜间模式
  11. 有哪些免费批量删除PDF文档的页码的方法
  12. ArcHydroTools 10.5版本的安装与使用(附下载链接与教程)
  13. V831基础-UART
  14. react中prop-types的使用
  15. 【学习随记】Ubuntu使用U盘相关问题
  16. android系统wifi控制风扇,无线远程遥控风扇设计实现
  17. HTML基础之 HTML5新增视频和音频标签
  18. 大数据基础教程丨TiDB数据库从入门到实践
  19. python3 冒泡排序 快速排序
  20. 单词串联记忆 - 故事 - Party上浪漫的事后传

热门文章

  1. [转]Windows Shell 编程 第十三章 【来源:http://blog.csdn.net/wangqiulin123456/article/details/7988004】...
  2. BLE-NRF51822教程5-静态密码设置
  3. 蓝牙BLE LINK LAYER剖析(一) -- status and channel
  4. 数据挖掘 —— 模型评估
  5. XGBoost Plotting API以及GBDT组合特征实践
  6. Description Resource Path Location Type Java compiler level does not match the version of the instal
  7. C++ Primer 5th笔记(chap 17 标准库特殊设施)匹配与 Regex 迭代器类型
  8. C++ Primer 5th笔记(chap 19 特殊工具与技术)异常类层次
  9. C++ Primer 5th笔记(chap 16 模板和泛型编程)类模板特例化
  10. Linux安装python-3.8