SpringBoot和Thymeleaf整合时出现TemplateInputException
出现这个异常的原因是后端接口中attributeName
与表单中的th:object="${order}"
不匹配导致,一个粗心的问题,记录一下。idea也会报红无法解析‘xxx’
@GetMapping("/current")
public String orderForm(Model model){
model.addAttribute("order",new Order());
return "orderForm";
}
<form method="post" th:action="@{/action}" th:object="${order}">