springboot thymeleaf 创建一个用户管理的前端页面(html)
时间: 2023-10-28 16:35:29 浏览: 77
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>User Management</title>
</head>
<body>
<h1>User Management</h1>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Action</th>
</tr>
<tr th:each="user : ${users}">
<td th:text="${user.id}"></td>
<td th:text="${user.name}"></td>
<td th:text="${user.email}"></td>
<td>
<a th:href="@{edit/{id}(id=${user.id})}">Edit</a>
<a th:href="@{delete/{id}(id=${user.id})}" onclick="return confirm('Are you sure?')">Delete</a>
</td>
</tr>
</table>
<br>
<form th:action="@{/save}" method="post">
<input type="hidden" th:field="*{id}">
<label for="name">Name:</label>
<input type="text" th:field="*{name}" required>
<br>
<label for="email">Email:</label>
<input type="email" th:field="*{email}" required>
<br>
<button type="submit">Save</button>
</form>
</body>
</html>
阅读全文