属性 尝试使用索引为每个循环使用 jstl 打印列表值时未找到
property not found when trying to print list value using jstl for each loop using index
我正在尝试使用 jstl 为每个循环打印列表值,如下所示。
<c:forEach var="listitems" varStatus="count" items="${list}">
<c:if test="${count.index > 0}">
<c:out value="${listitems[count.index]}"></c:out>
</c:if>
这里的列表包含字符串元素 type.When 我正在使用 count.index 它说 属性 0 not found on type string .
使用 var
attribute 引用当前项目。
<c:forEach items="${list}" var="item">
<c:out value="${item}" />
</c:forEach>
我正在尝试使用 jstl 为每个循环打印列表值,如下所示。
<c:forEach var="listitems" varStatus="count" items="${list}">
<c:if test="${count.index > 0}">
<c:out value="${listitems[count.index]}"></c:out>
</c:if>
这里的列表包含字符串元素 type.When 我正在使用 count.index 它说 属性 0 not found on type string .
使用 var
attribute 引用当前项目。
<c:forEach items="${list}" var="item">
<c:out value="${item}" />
</c:forEach>