Hashmap - How to generate div39s dynamically by iterating map using jstl in jsp page

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

   This question already has an answer here:
    * /questions/1835683/how-to-loop-through-a-hashmap-in-jsp /questions/1835683/how-to-loop-through-a-hashmap-in-jsp 2 answers

Answers

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

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

<c:forEach var="entry" items="${myMap}">
  Key: <c:out value="${entry.key}"/>
  Value: <c:out value="${entry.value}"/>
</c:forEach>

So here for example, it would be something like:

<c:forEach var="e" items="${images.holder}">
<div class="hex col-sm-6">
    <div>
        <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">
<c:out value=
<c:out value=
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</c:forEach>
  NB:    This is meant to give you the main idea not to give you the complete solution.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/38000551/how-to-generate-divs-dynamically-by-iterating-map-using-jstl-in-jsp-page

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils