一枚java小学生,只是为了整理与分享,如有指点,欢迎联系
修改用户简单html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymrleaf.org">
<head>
<meta charset="UTF-8">
<title>update User</title>
</head>
<body>
<h1>this is update user</h1>
<form action="/updateUser" method="post" th:object="${user}"><br>
<label>uid:</label> <input type="text" name="uid" th:value="*{uid}" readonly><br>
<label>username:</label> <input type="text" name="username" th:value="*{username}" required><br>
<label>password:</label> <input type="password" name="password" th:value="*{password}" required><br>
<label>age:</label> <input type="text" name="age" th:value="*{age}" required><br>
<label>addr: </label><input type="text" name="addr" th:value="*{addr}" required><br>
<input type="submit" value="submit">
</form>
</body>
</html>
user展示html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymrleaf.org">
<head>
<meta charset="UTF-8">
<title>user</title>
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
</head>
<body>
<h1>this is user page</h1>
<h2><a href="#" th:href="@{/addUserPage}">adduser</a></h2>
<table class="table table-hover" style="margin: 0 auto; width: 70%">
<tr>
<td>uid</td>
<td>username</td>
<td>password</td>
<td>age</td>
<td>addr</td>
<td>manage</td>
</tr>
<tbody>
<tr th:each="u:${users}">
<td th:text="${u.uid}">0</td>
<td th:text="${u.username}">0</td>
<td th:text="${u.password}">0</td>
<td th:text="${#numbers.formatDecimal(u.age,1,2)}">0</td>
<td th:text="${u.addr}">0</td>
<td><a href="#" th:href="@{'/deleteUserByUid/'+${u.uid}}">delete</a> <a href="#" th:href="@{'/Users/'+${u.uid}}">update</a></td>
</tr>
</tbody>
</table>
</body>
</html>