Rectangle 27 1

hashmap How to generate div's dynamically by iterating map using jstl in jsp page?

<c:forEach var="e" items="${images.holder}">
<div class="hex col-sm-6">
        <div class="hexagon hexagon2 gallery-item">
            <div class="hexagon-in1">
                <div class="hexagon-in2" style="background-image: url(<c:out value="${e.value}"/>);">
                    <div class="overlay">
                        <a href="<c:out value="${e.value}"/>" data-rel="lightbox" class="fa fa-expand"></a>
<c:forEach var="entry" items="${myMap}">
  Key: <c:out value="${entry.key}"/>
  Value: <c:out value="${entry.value}"/>

I'm not sure I understand what should be the expected result at the end so let me just give you some inputs.

NB: This is meant to give you the main idea not to give you the complete solution.

So here for example, it would be something like:

Thanks a lot. This works perfectly fine. Also if I need to know whether I am iterating first element or second element or third element in a map, how can I do that? I just need an indication basically I need to add a check with if statement that if it is the first element then do this and if it is second element, then do that.

To iterate over the entries of a Map and to get the value and the key of the current entry we proceed as next: