日期:2014-05-18  浏览次数:20666 次

logic:iterate 如何获得2重list里的数据?
我的数据是 List<List<Shift>> defaultShiftTime;

现在我要获取所有的 defaultShiftTime.get(i).get(0).hours

请问如何实现?
下面这个例子不行

<nested:iterate id="shiftTime" name="permanagerForm" property="defaultShiftTime" indexId="index">
<html:text property='hours' name="shiftTime[0]" indexed="true"/>
</nested:iterate>

错误提示 javax.servlet.jsp.JspException: Cannot find bean shiftTime[0] in any scope

------解决方案--------------------
你那样子写好像有点问题,name="shiftTime[0]"没有这种用法,你可以两次遍历集合,然后再用<logic:equals/>判断一下,
判断你要的第一个就行了