【发布时间】:2020-07-03 07:21:15
【问题描述】:
我正在处理我的“Edit.html”。 此页面上有一个表单,该页面用于编辑现有页面上的信息。 我对许多网站都使用了相同的“发布”方法并且没有错误。 但我不知道为什么我此时会出现以下错误。
我的控制器:
@PostMapping("editKursInfo")
public String editKursInfo(
@Valid @ModelAttribute("edit") Kurs kurs)
{
data.saveKurs(kurs);
return "redirect:/editKursInfo";
}
HTML (为了看起来方便,我删除了相关的HTML布局代码):
<form action="editKursInfo" method="POST" th:object="${edit}">
<span th:text="${kurs.kursName}" id="kursNameSpan" style=" display: none;"></span>
<td align="left" >Kurs Name</td>
<td>
<input th:field="*{kursName}"
type="text"
align="left"
class="form-control"
style="width:250px;"
placeholder="Bitte geben Sie Ihren Vornamen ein"
th:errorclass="is-invalid"
id="kursNameInput"
value=""/><br>
<div th:if="${#fields.hasErrors('kursName')}" th:errors="*{kursName}" class="invalid-feedback"> </div>
</form>
错误:
Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]
【问题讨论】:
标签: html spring-boot thymeleaf