springmvc参数绑定

浏览器的请求参数会自动绑定到Controller(Handler)中的方法的形式参数上,

  默认支持servletAPI的几个(request、response、session),

  Model(ModelAndView的一部分),ModelMap,简单类型同名的参数(当不同名时,可以使用@RequestParam注解完成对应),

  简单PO类型(字段名和页面name相同即可),

  包装类PO类型(需要使用QueryVO类型,如QueryVO中有个成员Items,Items有name、price,则页面表单name需为items.name、items.price即可),

  数组(需要使用QueryVO类型,如QueryVO中有个成员 Integer itemsIds[],则页面表单多个CheckBox的name需都为itemsIds),

  list集合(需要使用QueryVO类型,如QueryVO中有个成员 List<Items> itemsList,则页面表单name需为itemsList[index].id、itemsList[index].name、itemsList[index].price,当然通常index是使用循环标签如<c:forEach varStatus="status">中获取的${status.index}),

  map(需要使用QueryVO类型,如QueryVO中有个成员 Map<String, Object> itemInfo, 则页面表单name需使用itemInfo['name']、itemInfo['price'])

原文地址:https://www.cnblogs.com/gongchengshixiaobai/p/8026503.html