Jquery 在JSP中以2列显示数据
例如,我有以下数据:Jquery 在JSP中以2列显示数据,jquery,jsp,jstl,Jquery,Jsp,Jstl,例如,我有以下数据: 非洲 印度 澳大利亚 美国 俄罗斯 等等 这是我从数据库中收到的名为“国家”的数据 现在我想显示这些数据,以便在加载jsp时显示如下: 我用jsp编写的代码如下: ${country.index}${country.title} 如果在国家/地区中有N个元素,则半索引为N/2 <table> <tr> <td> <c:forEach items="${country}" var=
${country.index}${country.title}
如果在国家/地区中有N个元素,则半索引
为N/2
<table>
<tr>
<td>
<c:forEach items="${country}" var="countrySetA" begin="0" end="${halfIndex}">
${countrySetA.index} ${countrySetA.title}<br/>
</c:forEach>
</td>
<td>
<c:forEach items="${country}" var="countrySetB" begin="${halfIndex}">
${countrySetB.index} ${countrySetB.title}<br/>
</c:forEach>
</td>
</tr>
</table>
${countrySetA.index}${countrySetA.title}
${countrySetB.index}${countrySetB.title}
添加另一列并循环行(如果您也想这样做,也可以循环两列)
${country.index}
${country.title}
图像未显示
<table>
<c:forEach items="${country}" var="country">
<tr>
<td>
${country.index}
</td>
<td>
${country.title}
</td>
</tr>
</c:forEach>
</table>