@RequestMapping(value="/list",method=RequestMethod.GET) public String list(Model model) { //前台输出必须使用形如${ul.value.id }的形式 model.addAttribute("userList",userList); return "user/userList"; } @RequestMapping(value="/userlist",method=RequestMethod.GET) public String list(HttpServletRequest request) { //前台输出必须使用形如${user.id }的形式 List<User> userList = new ArrayList<User>(); userList.add(new User("1","yonghu1","121","1@qq.com")); userList.add(new User("2","yonghu2","122","2@qq.com")); userList.add(new User("3","yonghu3","123","3@qq.com")); request.setAttribute("userList", userList); return "user/userList"; }为什么前台取值时得使用不同的方法呢?HttpServletRequest和model不都是以map键值对的形式存数据的吗?
添加回答
举报
0/150
提交
取消