Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在JSP中关联两个ArrayList_Java_Jsp_Arraylist_Jstl - Fatal编程技术网

Java 在JSP中关联两个ArrayList

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

我正在尝试将这两个arraylist和print关联起来

            <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]}”