に問題があります@ModelAttribute
。
CustEntity
「名前」などのオブジェクトがありますBankAccEntity
。番号と名前を持つ、呼び出された bankAcc のリストもあります。
GET メソッドで、getBankAcc()
cust has arraylist with bankaccounts を使用すると、オブジェクト「顧客」を GET から POST に渡すと、BankAcc
リストに [] があります;/
私のコードフラグメントは以下の通りです:
@RequestMapping(value = "/aaa.html", method = RequestMethod.GET)
public String aaaGet(Model m, Principal principal) {
...
CustEntity cust = custService.getCustByUserName(principal);
cust.getBankAcc();
m.addAttribute("customer", cust);
...
}
@RequestMapping(value = "/aaa.html", method = RequestMethod.POST)
public String aaaPost(
@ModelAttribute("customer") CustomerEntity cust,
BindingResult results, RedirectAttributes redirectAttributes,
Model m) {
cust.getBankAcc();
...
}
よろしく、swerzy