我将studentList放入request作用域中jsp可以访问,为什么通过ModelAndView的addObject方法放入后,前台就无法访问。
后台方法:
@RequestMapping("/studentList")
public ModelAndView studentList(HttpServletRequest request) throws Exception{
ModelAndView mav = new ModelAndView("studentList");
// List studentList = iStudentService.queryAllStudent();
// System.out.println(studentList.size());
// request.setAttribute("studentList", studentList);
mav.addObject("studentList", iStudentService.queryAllStudent());
mav.addObject("xx", "xx");
// mav.addObject("studentList",studentList);
return mav;
}
前台代码
${xx}
id | name | birthday | creatTime |
${student.id} | ${student.name} | ${student.birthday} | ${student.createTime} |