i have problem with @ModelAttribute
,
CustEntity
have objects like "name" etc. also have list of BankAccEntity
called bankAcc which has number and name.
in GET method when i use getBankAcc()
my cust has arraylist with bankaccounts, but when i pass object "customer" from GET to POST, he has [] in BankAcc
list;/
my code fragment is below:
@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();
...
}
regards, swierzy