In a servlet I have:
HashMap eventsByDayNo = new HashMap();
eventsByDayNo.put (new Integer(12), "day 12 info");
eventsByDayNo.put (new Integer(11), "day 11 info");
eventsByDayNo.put (new Integer(15), "day 15 info");
eventsByDayNo.put (new Integer(16), "day 16 info");
request.setAttribute("eventsByDayNo", eventsByDayNo);
request.setAttribute("daysInMonth", new Integer(31));
And in a jsp I have:
<c:forEach var="dn" begin="1" end="${daysInMonth}" step="1" varStatus="status">
Day Number=<c:out value="${dn}" /> Value=<c:out value="${eventsByDayNo[dn]}" /><br>
</c:forEach>
The above JSTL works fine, but if I try to offset the day number <c:out value="${eventsByDayNo[dn+3]}" />
none of the hashmap entries are not printed. Any answers as to why not?
The above is just a proof of concept for my real application.