1)添加对themeleaf的支持的依赖

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

2)在resources的templates目录下新建currentTime.html

th:text的含义是把值显示在当前的标签内

字符串拼接采用双竖||符号就可以

3)修改application.properties,添加如下配置

#thymeleaf 配置
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type=text/html
#缓存设置为false,立即生效
spring.thymeleaf.cache=false

输入controller层的路径就可以看到页面效果

springboot的推荐模板引擎-Thymeleaf的更多相关文章

  1. SpringBoot:模板引擎 thymeleaf、ContentNegotiatingViewResolver、格式化转换器

    目录 模板引擎 thymeleaf ContentNegotiatingViewResolver 格式化转换器 模板引擎 thymeleaf.ContentNegotiatingViewResolve ...

  2. Spring Boot (四)模板引擎Thymeleaf集成

    一.Thymeleaf介绍 Thymeleaf是一种Java XML / XHTML / HTML5模板引擎,可以在Web和非Web环境中使用.它更适合在基于MVC的Web应用程序的视图层提供XHTM ...

  3. 新一代Java模板引擎Thymeleaf

    新一代Java模板引擎Thymeleaf-spring,thymeleaf,springboot,java 相关文章-天码营 https://www.tianmaying.com/tutorial/u ...

  4. 8.SpringBoot 模板引擎 Thymeleaf

    1.模板引擎原理 JSP.Velocity.Freemarker.Thymeleaf 都是模板引擎.SpringBoot推荐的Thymeleaf:语法更简单,功能更强大: Thymeleaf模板引擎 ...

  5. SpringBoot入门:新一代Java模板引擎Thymeleaf(理论)

    Spring Boot 提供了spring-boot-starter-web来为Web开发予以支持,spring-boot-starter-web为我们提供了嵌入的Tomcat以及SpringMVC的 ...

  6. springboot:Java模板引擎Thymeleaf介绍

    Thymeleaf是一款用于渲染XML/XHTML/HTML5内容的模板引擎.类似JSP,Velocity,FreeMaker等,它也可以轻易的与Spring MVC等Web框架进行集成作为Web应用 ...

  7. SpringBoot系列:Spring Boot使用模板引擎Thymeleaf

    一.Java模板引擎 模板引擎(这里特指用于Web开发的模板引擎)是为了使用户界面与业务数据(内容)分离而产生的,它可以生成特定格式的文档,用于网站的模板引擎就会生成一个标准的HTML文档. 在jav ...

  8. SpringBoot入门系列(四)整合模板引擎Thymeleaf

    前面介绍了Spring Boot的优点,然后介绍了如何快速创建Spring Boot 项目.不清楚的朋友可以看看之前的文章:https://www.cnblogs.com/zhangweizhong/ ...

  9. SpringBoot系列: Pebble模板引擎

    ===============================Java 模板引擎选择===============================SpringBoot Starter项目向导中可选的J ...

随机推荐

  1. WEB笔记-2 剖析CSS规则

    2.1 剖析CSS规则   规则即指令,其声明了需要修改的元素及要应用给元素的样式.     2.2 为文档添加样式的三种方法   行内样式:直接写在HTML文档标签中的style属性当中,行内元素只 ...

  2. 复习java基础第一天

    一:static static: 静态的.   1. 若需要一个类的多个对象共享一个变量,则该变量需要使用 static 修饰.   2. 因为 static 修饰的变量为类的所有的实例所共享,所以 ...

  3. 安卓代码迁移:ActionBarActivity: cannot be resolved to a type

    参考链接:http://stackoverflow.com/questions/18830736/actionbaractivity-cannot-be-resolved-to-a-type in e ...

  4. 安卓多线程——AsyncTask

    在采集视频的同时需要对视频进行实时处理,因此要使用到多线程. AsyncTask是android提供的一个处理异步任务的框架,相当于Handler+Thread.相比而言,AsyncTask的优点是封 ...

  5. Canopy聚类算法分析

          原文链接:http://blog.csdn.net/yclzh0522/article/details/6839643 Canopy聚类算法是可以并行运行的算法,数据并行意味着可以多线程进 ...

  6. drf04 drf视图类

    REST framework 提供了众多的通用视图基类与扩展类,以简化视图的编写. 1.2个视图基类 1.1. APIView rest_framework.views.APIView APIView ...

  7. MySQL+Keepalived实现主主高可用方案

    Mysql主主高可用方案 master配置 [root@master ~]# yum -y install keepalived [root@master ~]# vim /etc/keepalive ...

  8. atcoder.keyence2019.contest E-Connecting Cities

    真是道好题啊,当时怎么想都没想出来... 传送门 简述题意: 有n个点,每个点有一个权值Ai,连接i,j两个点的代价是 |i−j|×D+Ai+Aj  其中D是给定的常数,问把n个点联通的最小代价 1≤ ...

  9. UI Testing

    UI Test能帮助我们去验证一些UI元素的属性和状态.Apple 在 Xcode 7 中新加入了一套 UI Testing 的工具,其目的就是解决自动化UI测试这个问题.新的 UI Testing ...

  10. [POI2010] Intelligence test

    yyl说是用链表O(n)做 但是并脑补不出来. 发现可以用个vector记录一下每个数出现的位置,然后对于每个新序列就二分一下,找下一个数出现的离当前位置最近的位置,更新一下当前位置即可. 时间复杂度 ...