I have parameters from the client that are being sent such as
ids[] = 11
ids[] = 12
ids[] = 21
On the server side, I have a Spring controller with the following method:
@RequestMapping("/delete.x")
public @ResponseBody Map<String, Object> delete(HttpServletRequest request, @RequestParam("ids[]") List<Integer> ids) {
When I try to iterate over the collection of ids as follows:
for (Integer id : ids) {
I get an exception as follows:
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
Is Spring changing the type of ids to List<String>? No matter I suppose, how can I avoid this issue and have the ids stored as Integers inside of a List?