JSTL 问题
<sql:query var= "entityMaps " dataSource= "${ds} " scope= "request ">
SELECT * FROM R2007_science_item_info
WHERE report_base_info_id = ?
<sql:param value= "${param.reportBaseInfoId} " /> </sql:query>
<c:forEach var= "par " items= "${entityMaps} ">
<c:forEach var= "pv " items= "${par.row} ">
<tr>
<td>
<input type= "text " value= "${entityMaps.rows[pv].item_name} " />
<input type= "text " value= "${entityMaps.rows[pv].item_info} " />
</td>
</tr>
</c:forEach>
</c:forEach>
我想通过foreach循环,一次显示出每一行的记录,我这样写有问题,哪位大侠帮帮忙,解决一下这个问题,谢谢,在线等。
------解决方案-------------------- <c:forEach var= "pv " items= "${entityMaps} ">
<tr>
<td>
<input type= "text " value= "${pv.item_name} " />
<input type= "text " value= "${pv.item_info} " />
</td>
</tr>
</c:forEach>
------解决方案--------------------首先,要确定entityMaps对象类型。
如果是List,而且里面的的每一个元素是一个Object[] <String> :
<c:forEach var= "par " items= "${entityMaps} " varStatus= "vs ">
<tr>
<td>
<input type= "text " value= "${par[0]} " />
<input type= "text " value= "${par[1]} " />
.....
</td>
</tr>
</c:forEach>
请楼主说明一下检索出来的数据是怎样封装的。