您需要使用
th:action
标签而不是操作标签。并在 html 标签中指定第 th 命名空间。
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
</head>
<body>
<h1>Fill out the form</h1>
<form th:action="@{/submit}" method="post" th:object="${person}">
<span th:if="${#fields.hasErrors('name')}" th:errors="*{name}" class="error"></span>
<label for="name">Person Name:</label>
<input type="text" id="name" th:field="*{name}" />
<br />
<label for="orgName">Organization:</label>
<input type="text" id="orgName" th:field="*{orgName}" />
<br />
<label for="email">Email:</label>
<input type="email" id="email" th:field="*{email}" />
<br />
<label for="telephone">Telephone:</label>
<input type="tel" id="telephone" th:field="*{phone}" />
<br />
<button type="submit">Submit</button>
</form>
</body>
</html>
查看详细信息