Im trying to use @SessionAttributes in my controller class as follows:
@Controller
@SessionAttributes({"calMethods", "taxList"})
@RequestMapping("/secure")
public class reportController extends BaseController {
//..
@ModelAttribute("taxList")
public List<multiCalDto> getTaxList() {
return new ArrayList<multiCalDto>();
}
//....
@RequestMapping(value = "/confirmCal.html", method = RequestMethod.GET)
public ModelAndView launchconfirmCal(HttpServletRequest request, @RequestParam("seqNo") String seqNo) {
...........
ModelAndView modelAndView = new ModelAndView("confirmCalView");
modelAndView.addObject("taxList", calBean.getTaxList());
return modelAndView;
}
@RequestMapping(value = "/executeCalPay.html", method = RequestMethod.POST)
public ModelAndView executeCalPay(HttpServletRequest request, @ModelAttribute("taxList") List<multiCalDto> taxList) {
// ............
ModelAndView modelAndView = new ModelAndView("calView");
System.out.println("taxList -- "+taxList);
return modelAndView;
}
}
I added taxList in launchconfirmCal() and trying to access the same in executeCalPay(). I tried to print taxList before adding to modelAttribute and the size is 12 and when I retireve in executeCalPay() it shows null. I am not changing its value in JSP.
Aucun commentaire:
Enregistrer un commentaire