此代码发送了get请求,为什么?
<form th:action="@{/books/edit/rename}" th:object="${book}" th:method="POST">
<input type="text" id="id" name="id" th:value="*{id}" value="1"/>
<input type="text" id="bookName" name="bookName" th:value="*{bookName}" value="nameExample"/>
<button type="submit">Rename for model</button>
</form>
答案 0 :(得分:0)
尝试删除方法声明中的 th:,如下所示:
<form th:action="@{/books/edit/rename}" th:object="${book}" method="POST">
…
因为它不读取代码,默认值为GET,请检查此以获取更多详细信息https://www.w3.org/TR/html401/interact/forms.html#h-17.3