You can use varStatus
attribute to get the index of the current item:
<c:forEach items="${dataSetList}" var="dataSetVar">
${dataSetVar.group} <br/>
<c:forEach items="${dataSetVar.fruitList}" var="fruit" varStatus="loopCount">
<c:out value="${fruit}" />
<c:out value="${dataSetVar.priceList[loopCount.index]}" />
</c:forEach>
</c:forEach>
But note that your version and this one will give different output. With this single loop, each iteration will print elements from both list. While in your code, first all elements from fruitList
is printed, and then all elements from priceList
is printed. Choose which ever you want.