el表达式获取list数据报错:java.lang.NumberFormatException: For input string: "xxx"

我需要实现的功能是一个User 有多个roles,User类里面添加了roles的list,controller查询后传给success.jsp,提示java.lang.NumberFormatException: For input string: "xxx",

el表达式获取list数据报错:java.lang.NumberFormatException: For input string: "xxx"

el表达式获取list数据报错:java.lang.NumberFormatException: For input string: "xxx"

后来查询资料,是由于list会默认将后面的数据当做下标读取,会出现这个情况,

el表达式获取list数据报错:java.lang.NumberFormatException: For input string: "xxx"

只要标明下标或者再次foreach遍历roles的list就可以了。


el表达式获取list数据报错:java.lang.NumberFormatException: For input string: "xxx"