0
試圖創建百里香葉形式,但我不斷收到以下錯誤信息:處理器的執行過程中請告訴我錯了我Thymeleaf形式
錯誤「org.thymeleaf.spring4.processor.attr.SpringInputGeneralFieldAttrProcessor」(客戶 - 型:19)
這裏是我的Thymeleaf的模板:
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Save Customer</title>
<link type="text/css" rel="stylesheet" href="style.css"/>
<link type="text/css" rel="stylesheet" href="add-customer-style.css"/>
</head>
<body>
<div id="wrapper">
<div id="header">
<h2>Customer Relationship Manager</h2>
</div>
</div>
<div id="container">
<h3>Save Customer</h3>
<form action="saveCustomer" th:object="${customer}" method="post"/>
<table>
<tbody>
<tr>
<td><label>First Name</label></td>
<td><input type="text" th:field="*{firstName}"/></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
,並保持它的控制器:
@Controller
public class CustomerController {
private ServiceDAO serviceDAO;
@Autowired
public void setServiceDAO(ServiceDAO serviceDAO) {
this.serviceDAO = serviceDAO;
}
@RequestMapping("/")
public String listCustomers(Model model){
List<Customer> customers = serviceDAO.findAll();
model.addAttribute("customers", customers);
return "home";
}
@GetMapping("/ShowFormForAdd")
public String ShowFormForAdd(Model model){
Customer customer = new Customer();
model.addAttribute("customer", customer);
return "customer-form";
}
}
非常感謝! –
如果有效,只需用複選標記和/或upvote標記。 – bphilipnyc