I have a snippet of html like below in my jsp page which works fine if I start the service since everything is static. As you can see below I am showing different images within div <div class="row templatemorow">
. Only the images url is different and all other classes, fields are same.
<div class="row templatemorow">
<!-- How to generate these below div dynamically and just change the image url -- >
<!-- First Image -->
<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(images/gallery/1.jpg);">
<div class="overlay">
<a href="images/gallery/1.jpg" data-rel="lightbox" class="fa fa-expand"></a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Second Image -->
<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(images/gallery/2.jpg);">
<div class="overlay">
<a href="images/gallery/2.jpg" data-rel="lightbox" class="fa fa-expand"></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Now I am trying to make this dynamic as I already have image url
in a map so I just need to figure out how to iteare this map and generate div <div class="hex col-sm-6">
dynamically by changing the image url in it? I am using JSTL here.
I have a string to string map called holder
in which key is title
and value is full image url with http
so I need to iterate this holder
map and generate div dynamically with different image url. So If I have 10 entries in the map then there should 10 div with class="hex col-sm-6"
generated dyanmically I guess.
<div class="row templatemorow">
<!-- How to generate these below div dynamically and just change the image url -- >
<c:forEach var="e" items="${images.holder}">
<!-- iterate holder map and generate div's accordingly -- >
</div>
I am new to JSTL so I am not able to understand how can I generate these div's dynamically by iterating the holder
map in my JSP page.