【发布时间】:2012-03-18 09:01:36
【问题描述】:
@ModelAttribute 有问题,
在 GET 方法中,当我使用 getBankAcc() 时,我的客户有带有银行账户的数组列表,但是当我将对象“客户”从 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();
...
}
问候, 风骚的
【问题讨论】:
标签: java spring-mvc modelattribute