介绍
将请求参数封装到 List 中
注意: 不用此注解,会报错
应用场景
比如批量删除等
html 代码
<form action="/student/deleteByIds" method="post">
<input type="submit" value="批量删除">
<table>
<tr>
<td></td>
<td>姓名</td>
</tr>
<tr>
<td><input type="checkbox" name="ids" value="1"></td>
<td>李雷</td>
</tr>
<tr>
<td><input type="checkbox" name="ids" value="2"></td>
<td>韩梅梅</td>
</tr>
<tr>
<td><input type="checkbox" name="ids" value="3"></td>
<td>lucy</td>
</tr>
</table>
</form>
Controller 代码
@RequestMapping("/deleteByIds")
public String deleteByIds( @RequestParam("ids") List ids){
for(Object id:ids){
System.out.println(id);
}
return "deleteSuccess";
}

