springboot- Thymeleaf- table模板.

SpringBoot 项目中Bootstrap-table 的使用:
https://blog.csdn.net/yan88888888888888888/article/details/83651507

bootstrab table+表格 select可编辑完整实例:
https://www.cnblogs.com/zgghb/p/6296096.html

SpringBoot系列——Thymeleaf模板:
https://www.cnblogs.com/huanzi-qch/p/9930390.html

spring boot ----> 常用模板freemarker和thymeleaf:
https://www.cnblogs.com/mrray1105/p/9432659.html

spring+thymeleaf实现表单验证数据双向绑定:
https://www.cnblogs.com/jin-zhe/p/8241187.html

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot 是一个用于快速开发基于 Spring 框架的应用程序的工具。Thymeleaf 是一种模板引擎,可与 Spring Boot 一起使用来构建动态的 Web 应用程序。 要在 Spring Boot 中使用 Thymeleaf,首先需要在项目的 pom.xml 文件中添加以下依赖: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> ``` 然后,在 Spring Boot 的配置文件中配置 Thymeleaf 的相关属性。例如,在 application.properties 文件中添加以下配置: ``` spring.thymeleaf.mode=HTML spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.cache=false ``` 接下来,您可以创建一个控制器类来处理请求并渲染 Thymeleaf 模板。例如,假设您有一个 UserController 类处理用户相关的请求: ```java @Controller public class UserController { @GetMapping("/users") public String getUsers(Model model) { List<User> userList = // 从数据库或其他数据源获取用户列表 model.addAttribute("users", userList); return "user-list"; // 返回 Thymeleaf 模板名称 } } ``` 在上面的例子中,我们使用 `@GetMapping` 注解来处理 GET 请求,并将用户列表添加到模型中。然后,我们返回了一个名为 "user-list" 的 Thymeleaf 模板。 接下来,您可以创建一个名为 "user-list.html" 的 Thymeleaf 模板文件来定义如何渲染用户列表。以下是一个简单的示例: ```html <html> <head> <title>User List</title> </head> <body> <h1>User List</h1> <table> <tr th:each="user : ${users}"> <td th:text="${user.id}"></td> <td th:text="${user.name}"></td> <!-- 其他用户属性 --> </tr> </table> </body> </html> ``` 在上面的例子中,我们使用 Thymeleaf 的 `th:each` 属性来迭代用户列表,并在表格中显示每个用户的属性。 最后,您可以运行您的 Spring Boot 应用程序并访问 "/users" 路径,您将看到渲染后的用户列表页面。 这只是一个简单的示例,您可以根据需要使用更多的 Thymeleaf 功能来创建更复杂和动态的页面。希望这可以帮助到您!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值