java - associating two ArrayList in JSP -


i trying associating 2 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> 

i want print "comment" "comment time" values of 2 different arraylists code printing whole first arraylist , second one.

any hint???!

you have use varstatus attribute current index, , print elements both arraylists @ index (this of course assuming both arraylists contains same number of elements):

<c:foreach items="${postitem.comment}" var="comment" varstatus="status">     <span>comment="${comment}" </span>     <span>comment_time="${postitem.commenttime[status.index]}"  </span> </c:foreach> 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -