【Thymeleaf】Thymeleaf中的判断语句_thymeleaf 判断_飝鱻.的博客-CSDN博客
thymeleaf中th:text和th:utext的区别_th:text th:utext_雪心玉竹的博客-CSDN博客
thymeleaf块标签(空标签)th:block,标签本身不显示_程序员刘杨 (yyjjssnn.cn)
- @Controller
- public class TestController {
-
- @Autowired
- MenuService menuService;
-
-
- @GetMapping(value = "/index")
- public String index(Model model) {
- List
- model.addAttribute("list", list);
- model.addAttribute("name", "吕怡婷");
- model.addAttribute("age", 22);
- return "/layui/index";
- }
-
- @PostMapping(value = "/insert")
- public String insert() {
- return null;
- }
-
- @GetMapping(value = "/delete")
- public String delete() {
- return null;
- }
- }
- @Controller
-
- public class Test2Controller {
- @Autowired
- MenuService menuService;
-
-
- @GetMapping(value = "/skip")
- public String skip(Model model,String name,String age) {
- model.addAttribute("age", age);
- model.addAttribute("name", name);
- return "/layui/skip";
- }
- }
- html>
- <html xmlns:th="http://www.thymeleaf.org">
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Titletitle>
- <link rel="stylesheet" href="/lib/layui-v2.7.6/css/layui.css">
- head>
- <body>
- <link rel="stylesheet" href="/lib/layui-v2.7.6/layui.js">
- <div th:each="menu:${list}">
- <span th:text="${menu.menuName}">span>--<span th:text="${menu.id}">span>
- <br>
- div>
- <span th:text="${name}?'ok':'on'">span>
- <br>
- <span th:text="${menu1}">span>
- <br>
- 变量:[[${name}]]
- <br>
- <span th:text="|${name}喜欢吃辣喜喜|">span>
- <br>
- <a th:href="@{/skip(name=${name},age=${age})}">跳转测试a>
- <div th:with="name3=${name}+'xixix'">
- <p th:text="${name3}">hap>
- div>
- <p th:text="${name3}">jjjp>
-
- <h3> th:remove h3>
- <div >
- all:<div th:remove="all"><div id="hello1">你好11div>div>
- body:<div th:remove="body"><div id="hello2">你好11div>div>
- tag:<div th:remove="tag"><div id="hello3">你好11div>div>
- tag:<div th:remove="none"><div id="hello4">你好11div>div>
- div>
-
- <th:block th:if="${age}==23">
- <div>hahahaaaadiv>
- <div>oooooodiv>
- th:block>
-
- body>
- html>

自学 使用thymeleaf提交form表单给controller(springboot)_thymeleaf提交表单_梦梦~~的博客-CSDN博客