我正尝试使用springMvc和thymeleaf创建编辑表单。输入字段没有使用从控制器返回的值填充。输入字段在Thymeleaf Spring MVC中显示为空白
控制器:
@RequestMapping(value = "updatecustomer")
public String search(@ModelAttribute("customerDto") CustomerDto customerDto, Model model) {
Customer customer = service.search(customerDto);
model.addAttribute("customer", customer);
return "mypage";
}
形式:
<input type="text" id="email" name="email" value="">
调试示出的值是存在于控制器并返回到查看但电子邮件输入:在浏览器
<form method="post" th:action="@{updatecustomer}" th:object="${customerDto}">
<label>Email: </label><input type="text" th:field="*{email}" />
<input type="submit" />
</form>
生成html值为空白。
请指教。