Java 在JSP中关联两个ArrayList
我正在尝试将这两个arraylist和print关联起来Java 在JSP中关联两个ArrayList,java,jsp,arraylist,jstl,Java,Jsp,Arraylist,Jstl,我正在尝试将这两个arraylist和print关联起来 <c:when test="${postitem.posttype.equals('text')}"> <h5>id="${postitem.postid}"</h5> <pre> ${postitem.postdata} </pre> <spa
<c:when test="${postitem.posttype.equals('text')}">
<h5>id="${postitem.postid}"</h5>
<pre> ${postitem.postdata} </pre>
<span>datetime="${postitem.posttime}</span>
<c:forEach items="${postitem.comment}" var="comment">
<span>comment="${comment}" </span>
</c:forEach>
<c:forEach items="${postitem.commenttime}" var="comment_time">
<span>comment_time="${comment_time}" </span>
</c:forEach>
</c:when>
id=“${positem.postid}”
${positem.postdata}
datetime=“${positem.posttime}
comment=“${comment}”
comment_time=“${comment_time}”
我想打印带有“comment time”的“comment”,这是两个不同arraylist的值,但这段代码将打印整个第一个arraylist,然后再打印第二个arraylist
有任何提示吗?您必须使用
varStatus
属性获取当前索引,并在该索引处打印来自两个ArrayList的元素(当然,这是假设两个ArrayList包含相同数量的元素):
comment=“${comment}”
comment_time=“${positem.commenttime[status.index]}”