Note that there are some explanatory texts on larger screens.

plurals
  1. POnested forEach loop JSTL issue
    text
    copied!<p>i'm making a calendar using jstl and I ran into an issue where there can be more that one item per day....</p> <p>I'm attempting to use nested forEach loop to work this out however there is duplicate data occurring because of the nested forEach loop.</p> <p>here is my code:</p> <pre><code>&lt;div id="calendar_item_meta"&gt; &lt;c:forEach var="calendarItemMeta" items="${inboxCalendar.mapCalendar}" varStatus="status"&gt; &lt;c:set var="calendarItemCounts" value="${fn:length(calendarItemMeta.value[0].mailItemsPayable)}"/&gt; &lt;c:set var="calendarMappingMemoHolder" value="${calendarItemMeta.value[0].mailItemsPayable[status.index].billInfo.memo}"/&gt; &lt;c:set var="calendarMappingAmountHolder" value="${calendarItemMeta.value[0].amount}"/&gt; &lt;div id="item_${calendarItemMeta.key}"&gt; &lt;c:if test="${calendarItemCounts &gt; 0}"&gt; &lt;c:forEach var="i" begin="0" end="${calendarItemCounts}" step="1" varStatus ="status5"&gt; &lt;c:set var="calendarMappingItemHolder" value="${calendarItemMeta.value[0].mailItemsPayable[i].billInfo.presAcctId.billerInfo.name}"/&gt; &lt;p&gt;&lt;strong&gt;${inboxCalendar.currentMonth} ${calendarItemMeta.key}&lt;/strong&gt; ${calendarMappingItemHolder}&lt;/p&gt; &lt;/c:forEach&gt; &lt;c:if test="${calendarMappingAmountHolder != null}"&gt; &lt;p&gt;${calendarMappingAmountHolder}&lt;/p&gt;&lt;br&gt; &lt;/c:if&gt; &lt;c:if test="${calendarMappingAmountHolder != null}"&gt; &lt;p&gt;${calendarMappingMemoHolder}&lt;/p&gt; &lt;/c:if&gt; &lt;/c:if&gt; &lt;/div&gt; &lt;/c:forEach&gt; &lt;/div&gt; </code></pre> <p><strong>the date which shows up twice is the data inside the second ForEach loop.. how can I get around this?</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload