Thymeleaf在SpringBoot中的用法笔记

thymeleaf3.0.5中文版完全手册2017 thymeleaf 3.0.5 中文版 完全手册 2017 可以说是很完美了 立即下载

一、引入thymeleaf

pom.xml中配置

    <properties>
        <java.version>1.8</java.version>
        <!-- 控制thymeleaf版本 -->
        <thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
        <!-- 布局功能的支持程序 thymeleaf3的主程序 layout2以上版本 -->
        <!-- thymeleaf2 layout1 -->
        <thymeleaf-layout-dialect.version>2.5.1</thymeleaf-layout-dialect.version>
    </properties>
    <dependencies>
    	<!-- 引入tymeleaf模板引擎启动器 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
    </dependencies>

二、thymeleaf的使用

thymeleaf官方文档
只要我们把HTML页面放在classpath:/templates/,thymeleaf就能自动渲染;

1、导入名称空间

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

2、使用thymeleaf语法

<!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 th:text="${hello}">这是显示欢迎信息</div>
</body>
</html>

三、语法规则

**1、th:任意html属性 来替换原生属性的值 **
在这里插入图片描述
2、表达式

Simple expressions:(表达式语法)
    Variable Expressions: ${...}:获取变量值;OGNL;
    		1)、获取对象的属性、调用方法
    		2)、使用内置的基本对象:
    			#ctx : the context object.
    			#vars: the context variables.
                #locale : the context locale.
                #request : (only in Web Contexts) the HttpServletRequest object.
                #response : (only in Web Contexts) the HttpServletResponse object.
                #session : (only in Web Contexts) the HttpSession object.
                #servletContext : (only in Web Contexts) the ServletContext object.
                
                ${session.foo}
            3)、内置的一些工具对象:
#execInfo : information about the template being processed.
#messages : methods for obtaining externalized messages inside variables expressions, in the same way as they would be obtained using #{…} syntax.
#uris : methods for escaping parts of URLs/URIs
#conversions : methods for executing the configured conversion service (if any).
#dates : methods for java.util.Date objects: formatting, component extraction, etc.
#calendars : analogous to #dates , but for java.util.Calendar objects.
#numbers : methods for formatting numeric objects.
#strings : methods for String objects: contains, startsWith, prepending/appending, etc.
#objects : methods for objects in general.
#bools : methods for boolean evaluation.
#arrays : methods for arrays.
#lists : methods for lists.
#sets : methods for sets.
#maps : methods for maps.
#aggregates : methods for creating aggregates on arrays or collections.
#ids : methods for dealing with id attributes that might be repeated (for example, as a result of an iteration).

    Selection Variable Expressions: *{...}:选择表达式:和${}在功能上是一样;
    	补充:配合 th:object="${session.user}:
   <div th:object="${session.user}">
    <p>Name: <span th:text="*{firstName}">Sebastian</span>.</p>
    <p>Surname: <span th:text="*{lastName}">Pepper</span>.</p>
    <p>Nationality: <span th:text="*{nationality}">Saturn</span>.</p>
    </div>
    
    Message Expressions: #{...}:获取国际化内容
    Link URL Expressions: @{...}:定义URL;
    		@{/order/process(execId=${execId},execType='FAST')}
    Fragment Expressions: ~{...}:片段引用表达式
    		<div th:insert="~{commons :: main}">...</div>
    		
Literals(字面量)
      Text literals: 'one text' , 'Another one!' ,…
      Number literals: 0 , 34 , 3.0 , 12.3 ,…
      Boolean literals: true , false
      Null literal: null
      Literal tokens: one , sometext , main ,…
Text operations:(文本操作)
    String concatenation: +
    Literal substitutions: |The name is ${name}|
Arithmetic operations:(数学运算)
    Binary operators: + , - , * , / , %
    Minus sign (unary operator): -
Boolean operations:(布尔运算)
    Binary operators: and , or
    Boolean negation (unary operator): ! , not
Comparisons and equality:(比较运算)
    Comparators: > , < , >= , <= ( gt , lt , ge , le )
    Equality operators: == , != ( eq , ne )
Conditional operators:条件运算(三元运算符)
    If-then: (if) ? (then)
    If-then-else: (if) ? (then) : (else)
    Default: (value) ?: (defaultvalue)
Special tokens:
    No-Operation: _ 
从补码原理到实践:RISC-V中addi指令的符号扩展机制详解 本文深入解析了RISC-V架构中addi指令的符号扩展机制。从补码的数学原理出发,详细阐述了12位立即数在指令编码中如何通过符号位进行扩展,并结合lui指令,揭示了加载任意32位立即数的正确方法与实践陷阱,帮助开发者编写高效可靠的底层代码。 阅读详情

相关推荐

【ChatGPT实战案例】ChatGPT如何帮助产品经理高效工作?

1. 产品经理主要工作方向, 2. 具体工作中,向ChatGPT提问参考

weixin_62909516的博客 1900

深入SpringBoot-Thymeleaf模板引擎

什么是模板引擎? 模板引擎是为了使用户界面与业务数据(内容)分离而产生的,它可以生成特定格式的文档,用于网站的模板引擎就会生成一个标准的文档。简单来讲,用于网站的模板引擎就会生成一个标准的文档,其本质是将模板文件和数据通过模板引擎生成最终的HTML代码。 Thymeleaf SpringBoot推荐的Thymeleaf语法简单,功能更强大 引入Thymeleaf <dependency&...

追梦的小狼狗 381

实战解析:利用Python requests库高效抓取京东商品评论并构建结构化数据集

本文详细介绍了如何利用Python requests库高效抓取京东商品评论并构建结构化数据集。通过分析京东评论接口、处理反爬机制以及数据解析存储,帮助开发者快速获取电商数据,适用于竞品监控、用户画像构建等商业场景。

weixin_42526415的博客 838

金刀的博客 | Spring Boot Thymeleaf Java模板引擎

templates目录 该目录是是安全的,因为可以避免被外界直接访问,如果需要访问则需要借助于Controller去完成 thymeleaf thymeleaf是通过特定的标记语法对html标记做渲染 Thymeleaf是面向 Web 和独立环境的现代服务器端Java模板引擎,能够处理 HTML、XML、JavaScript、CSS 甚至纯文本。 Thymeleaf的主要目标是提供一个优雅和高度可...

YangZhaoSy 276

从零开始之驱动发开、linux驱动(七、字符驱动之led最终版)

我们上一接用的gpiolib非常杂乱,使用了两种 1.各硬件厂商实现的,如s3c_gpio_cfgpin(S5PV210_GPJ0(5), S3C_GPIO_SFN(1)) 2.系统公共的,如gpio_set_value(S5PV210_GPJ0(4),val) 其实公共的也是对各硬件厂商的封装,用那个都可以,个人建议用系统公共的,应为这样换芯片厂商,不影响任何使用。   2.错误处理基...

To_run_away的博客 2387

rk3568 rk628桥片 rgb2hdmi

RK628 是瑞芯微全新推出的视频桥接芯片,支持丰富的显示接口,支持高分辨率大屏产品转换需求。基于DRM、FB的显示框架易于使用。 输入信号支持:HDMI、RGB、BT.1120,输出信号支持 HDMI、GVI、Dual LVDS、Dual MIPI、MIPI-CSI、RGB、BT.1120,最高支持4K 60fps 输入/输出转换,并且支持输入到输出 1/4~4倍的缩放。

weixin_35723192的博客 452

若依框架的入门学习

项目中,使用到了若依的VUE的前后端分类框架,稍微了详细了解后发现,若依还有其他的一些开源框架,而且行成了生态。现在开发技术如火如荼,我们也跟着若依的部分,一窥优秀框架在做什么在用什么技术的现状。

4986

我的python学习之路

Python 是一门功能强大且易于学习的编程语言,广泛应用于数据分析、人工智能、Web 开发、自动化等领域。以下是一个 Python 学习路径的总结,帮助你系统地掌握 Python 编程。

数据知道的博客 3万+

Thymeleaf3.0简易教程

Demo下载,可以在这个demo上进行练习。 1.概述 SpringBoot支持的模板引擎: Thymeleaf(SpringBoot推荐) FreeMarker Velocity Groovy JSP(以前开发Java Web时用的,现在不推荐) 前后端分离开发虽然已普遍存在,Thymeleaf也可以很好的进行前后台的协作开发。 使用Thymeleaf 三大理由: 简洁...

weixin_40763897的博客 3337

AutoSAR系列讲解 - 资料下载

学习资料下载汇总

雪云飞星的博客 4万+

高匿反爬实战:Python打造无痕爬虫,规避风控系统追踪

网络层匿踪:核心是使用住宅IP代理池,按真实用户IP画像匹配,控制请求频率;协议层匿踪:动态生成请求头(每次都不同),参数添加随机噪声,避免规律化;行为层匿踪:模拟人类的非规律行为(贝塞尔轨迹、随机停顿、非精准点击);设备层匿踪:伪造Canvas/WebGL指纹,禁用webdriver标识,每次请求更换指纹;核心原则:无痕爬虫的本质是“无限接近真实用户”,所有维度都要消除爬虫特征,而非单一维度伪装。打造真正的无痕爬虫需要全维度的匿踪策略,单一维度的伪装极易被高级风控系统识别。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 2643

thymeleaf3.0的使用

一、常用模板引擎对比 简介 jsp Java Server Pages,动态网页技术,由应用服务器中的JSP引擎来编译和执行,再将生成的整个页面返回给客户端。支持表达式语言(EL、JSTL)。因为其是在服务器端渲染的,消耗性能,所以springboot项目中不在推荐使用jsp freemarker 文件一般保存为 xxx.ftl,严格依赖MVC模式,不依赖Servlet容器(...

学习记录和总结 9512

Nova — GPU/vGPU 虚拟机

目录 文章目录目录云主机使用显卡的实现方式虚拟显卡物理显卡直通物理显卡虚拟化 云主机使用显卡的实现方式 采用虚拟显卡 采用物理显卡直通 采用物理显卡虚拟化 虚拟显卡 虚拟显卡技术,主要用于虚拟机 Remote Console 领域,如:VNC(Virtual Network Computing,虚拟网络计算机),它能将完整的窗口界面通过网络,传输到另一台计算机的屏幕上。 VNC 主要由 VNC server 和 VNC viewer 两部分组成。用户需先将 VNC server 安装在被远程操控的计算

烟云的计算 2430

SpringBoot学习笔记(7)——SpringBoot整合Thymeleaf

SpringBoot学习笔记(7)——SpringBoot整合Thymeleaf 一、创建Thymeleaf的入门项目 1. 创建项目 2. 修改pom文件,添加坐标 <dependencies> <!-- springBoot的启动器 --> <dependency> <groupId>org.springfra...

njsunll的博客 395

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

springboot thymeleaf配置_【程序源代码】Spring Boot 开发笔记web开发实战1

关键字:《Spring Boot 开发笔记》系列文章各位亲爱的小伙伴:大家好!《Spring Boot 开发笔记》系列文章这套笔记和源码是我自己在学习springboot开发中实际一个字一个字敲出来的。因为这套开发笔记是逐步整理出来的,每期会介绍不同的技术开发点。所以请大家关注公众号,以便了解更多关于Spring Boot开发知识点。《Spring Boot开发笔记》web开发实战1章节...

weixin_39539807的博客 138

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Spring Boot整合Thymeleaf详细笔记

在上述配置中,`spring.thymeleaf.prefix`指定了模板文件的路径前缀,`spring.thymeleaf.suffix`指定了模板文件的后缀名,`spring.thymeleaf.cache`配置为`false`表示关闭Thymeleaf的模板缓存,以便在开发过程中能够实时看到模板的变化。综上所述,这段代码的作用是将`/static/`路径下的静态资源映射到`classpath:/static/`目录,使得我们可以通过`/static/`路径来访问静态资源。

m0_61752188的博客 868

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

【springboot】Thymeleaf笔记

文章目录标准变量:选择变量:路径表达式:图片文件:循环遍历list集合:循环遍历Array数组混合遍历:条件判断if:内敛表达式:字面量:拼接字符串:数字运算:从session中取数值:功能对象: 标准变量: <div th:text="${user.id}"></div> 选择变量: <div th:object="*{user}"> <span th:text="*{id}"></span> </div> 路径表达式:

weixin_44197120的博客 649

SpringBoot之Thymeleaf笔记

SpringBoot动态页面部署需要引入Thymeleaf 组件才能访问 整合Thymeleaf 依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> 配置文件 spring: thymeleaf: cac

weixin_44120790的博客 155

SpringBoot笔记04 SpringBoot打包,Thymeleaf模板

SpringBoot可以打包为war或jar文件,一两种方式发布应用pom.xml在pom.xml文件中配置内嵌Tomcat对jsp的解析包,并指定将jsp编译到指定目录 在main文件夹下新建webapp,并在Project Structure中将其设置为web项目的根目录在webapp下新建index.jsp新建Controllerapplication.properties 在pom.xml的build标签中指定打包后的文件名 发布war到Tomcat 主启动类继承SpringBootS

qq_53157982的博客 1071

SpringBoot笔记之三:用Thymeleaf渲染页面

这一篇文章来介绍下如何通过官方支持的Thymeleaf模板渲染Web页面。 Thyemeleaf Logo 添加Maven依赖 在pom.xml文件中添加spring-boot-starter-thymeleaf依赖。 SpringBoot Thymeleaf Starter Thymeleaf配置 默认情况下,SpringBoot会从 src/main/resources/templates 文件夹目录中找模板文件。可以通过在application.properties文件中添加如下配

keeper42的博客 1457

Thymeleaf在spring boot 2 recipe中的用法笔记

@GetMapping("/books.html") public String all(Model model) { model.addAttribute("books", bookService.findAll()); return "books/list"; } Finally, we return the name of the view to render books/list. ...

csdnnmbdybb的博客 134

springboot学习笔记——thymeleaf使用

springboot 是内嵌web容器的,推荐打成jar包不是war包,如果打包成外包就相当于失去了一些springboot的特性。 SpringBoot推荐的Thymeleaf,语法更简单,功能更强大; 引入thymeleaf <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thy

qq_29384339的博客 171

thymeleaf 获取yml中的值_SpringBoot从基础配置到Thymeleaf模板笔记

使用Spring Initializer快速创建Spring Boot项目IDE都支持使用Spring的项目创建向导快速创建一个Spring Boot项目;选择我们需要的模块;向导会联网创建Spring Boot项目;默认生成的Spring Boot项目;·主程序已经生成好了,我们只需要我们自己的逻辑.resources文件夹中目录结构static :保存所有的静态资源;js css images...

weixin_29813667的博客 1348

SpringBoot学习笔记15 - Thymeleaf

Thymeleaf是一个流行的模板引擎,该模板引擎采用 Java 语言开发。 Java 中常见的模板引擎有 Velocity、Freemaker、Thymeleaf 等。不同的模板引擎都会具有自己的特定的标签体系,而 Thymeleaf 以 HTML 标签为载体,在 HTML 的标签下实现对数据的展示。 Thymeleaf 本身与 SpringBoot 是没有关系的,但 SpringBoot 官方推荐使用 Thymeleaf 作 为前端页面的数据展示技术,SpringBoot 很好地集成了这种模

weixin_39997438的博客 609

Springboot+Thymeleaf+BootStrap整合笔记

目录 Springboot整合Thymeleaf yml文件配置 controller: 创建html文件 Springboot+Thymeleaf中常用的th标签 Springboot整合Thymeleaf+BootStrap Springboot整合Thymeleaf 依赖 <!--模板引擎--> <dependency> ...

Seven71111的博客 1764

springboot+thymeleaf学习笔记1

1.学习thymeleaf 了解什么是thymeleaf? Thymeleaf是一个用于web和独立环境的现代服务器端Java模板引擎。 Thymeleaf的主要目标是将优雅的自然模板引入到您的开发工作流程中-HTML可以在浏览器中正确显示,也可以作为静态原型工作,从而在开发团队中实现更强的协作。 有了Spring框架的模块、与您喜爱的工具的大量集成以及插入您自己的功能的能力,Thymel...

keny-大成的博客 401
上一篇: Linux之文件目录操作指令
下一篇: Linux之时间日期类指令
magicproblem
博客等级 码龄7年 22粉丝 59原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值