当前位置:网站首页>How can one page nest another page in thymeleaf? About page nesting, the tag tells you what you should know
How can one page nest another page in thymeleaf? About page nesting, the tag tells you what you should know
2022-07-22 19:06:00 【Vacanda forever】
Thymeleaf How to nest another page in a page
By convention , First analyze the project structure ,
static
It is under this project Static resource folder
, It is mainly used to put resources other than pages , There are generally no pages here , Because when loading the page , These resource files will be loaded first , The data required for loading the time domain has not been stored , Naturally, there is no data , So you can only place the page in templates Under the folder
templates
There are usually some under this folder Dynamic pages
, Usually you can't pass directly url Go straight to the page , Need to pass through Controller layer , Jump to the Controller Request data and jump back to the page ,(=-=!!)
It looks very flexible , After all, Spring Developed by the company , All are Spring Products , and Spring Can connect seamlessly , and jsp It's more convenient
Thymeleaf Problems caused by pages :
How to nest between two pages , as everyone knows , In actual development, a page will contain many other small modules , But it can't be accessed directly templates Files in the folder
Solution example :
-- page 1--
<!-- This page is called house_list-->
<body>
<!-- At this point, I want to add the following div The content in is nested into the page 2-->
<div th:fragment="myfooter">
<div> The page content </div>
</div>
</body>
-- page 2--
<body>
<!-- For example, I want to nest pages here 1-->
<!-- I need to replace Enter the name of the page , On the right, enter the page fragment The value in -->
<!-- To put it bluntly is to tell thymeleaf Who do you want to nest , Which part of it is nested -->
<div th:replace="house_list : : myfooter"></div>
</body>
Example :
Be careful :: Left and right Must have spaces
and
The transplanted page doesn't have you on the page 1 Styles in and resource files
So !!! It is very important to import resources well , Don't pile up on the page with many styles , The write css The document is written css file , The write images The document is written images file
In other words, your transplant is just div The content in does not mean that you have also moved the resource file
边栏推荐
- [summary of linked list skills] 141. Circular linked list (simple)
- Image quality evaluation
- Transformer, another city! The top of many low-level tasks was occupied, and Peking University Huawei and others jointly proposed the pre training model IPT
- 1.qt view source code
- Leetcode:196. delete duplicate email
- Date operation in shell script
- MySQL master-slave replication
- Shell脚本调试技术
- [QT source code reuse] qdatetimeedit drop-down button event response
- Shell variable operation ${} detailed usage
猜你喜欢
1. Closeable of qtablewidget, 2.pro/build_ pass、member,3.QString&&
程序员面试金典面试题 01.05. 一次编辑
MySQL master-slave replication
服务器磁盘IO性能调优
mysql执行过程以及顺序
Interrogation aléatoire de n données dans diverses bases de données
Data storage partition -- range partition, hash partition, list partition, and indispensable part of performance tuning
2、 Idea build jfinal project + automatic code generation + database operation test (three ways)
Wechat scans the QR code of the website, but only displays the link address, and cannot jump to the web page
JUC synchronizer
随机推荐
Flink学习笔记(六)Flink的时间和窗口
paper - A Physics-based Noise Formation Model for Extreme Low-light Raw Denoising
PTA exercises 8-6 delete characters
[sliding window technique] 76. Minimum covering substring
wget下载目录内的所有文件
卧式单面多轴钻孔组合机床动力滑台液压系统的设计
1. Qimage filling transparent brush; 2.path.addtext how to add line breaks
JVM system optimization
Flink learning notes (IV) Flink runtime architecture
【链表技巧汇总】141.环形链表(简单)
Leetcode: 184. the highest paid employee in the Department
MySQL execution process and sequence
numpy.reshape完成图像切割
1. Where is the date for qdate (), 2. QT_ Usage Summary of version
Parameter index out of range (1 &gt; number of parameters, which is 0).
The difference between shell $* and [email protected]
WGet downloads all files in the directory
Transformer再下一城!low-level多个任务榜首被占领,北大华为等联合提出预训练模型IPT
代码—
交叉熵损失函数