spring boot使用thymeleaf模板编写前端程序-文件路径和代码复用
来源:互联网 发布:linux man命令查询退出 编辑:程序博客网 时间:2024/06/05 20:37
thymeleaf是一套受spring boot开发者喜爱的前端模板,提供了适合spring boot特有框架体系的特殊html元素,比如html文件引入js代码不需要写绝对路径,只要运用th:src,之后跟templates目录下js文件的路径即可:
<script th:src="@{js/jquery.min.js}" type="text/javascript"></script>开发文件结构为:
当需要复用html代码时,可以将要服用代码提取到一个html文件中,并使用th:fragment标注想要复用的代码:
<footer th:fragment="footer"> <div class="bloc bgc-white l-bloc"> <div class="container bloc-md"> <div class="row bgc-white"> <div class="col-sm-12 text-center"> <img th:src="@{img/favicon.ico}" class="img-responsive center-block mg-sm" height="38" width="98" /> <p class="text-center"> © FreeCoding-R </p> </div> </div> </div> </div></footer>这样,在别的html文件中,便可以通过th:include,指出复用文件的路径以及复用文件中代码段的fragment值来复用这段代码:
<div th:include="components/components :: footer"></div>
阅读全文
0 0
- spring boot使用thymeleaf模板编写前端程序-文件路径和代码复用
- spring-boot--使用thymeleaf模板
- spring-boot--使用thymeleaf模板
- Spring Boot使用thymeleaf模板
- spring-boot--使用thymeleaf模板
- spring-boot--使用thymeleaf模板
- spring boot使用thymeleaf模板
- spring-boot--使用thymeleaf模板
- Spring Boot 使用 Thymeleaf模板
- spring-boot--使用thymeleaf模板
- Spring boot使用thymeleaf模板
- spring boot使用thymeleaf模板配置和freem
- Spring-boot中thymeleaf模板使用小结
- (8)spring boot使用thymeleaf模板引擎
- 9. Spring Boot使用thymeleaf模板
- Spring Boot使用Thymeleaf
- spring-boot--整合thymeleaf模板
- spring-boot thymeleaf模板学习
- 如何基于西安80坐标查询定位
- 通过谷歌浏览器的超链接打开本地一个exe文件
- Interge的自动装箱和拆箱比较问题
- 按优先级打印问题的实现(Java)
- 遍历目录和子目录中的文件
- spring boot使用thymeleaf模板编写前端程序-文件路径和代码复用
- 去除重复字符
- 快速傅里叶变换FFT
- apache、iis6、ii7屏蔽限制ip访问(适用虚拟主机)
- 在ubuntu下利用ssh控制树莓派教程
- js获取文件MD5值
- SPOJ 26777 ANTP
- elementui 表单验证
- C语言指针专题——为何要学习指针