user1669488
user1669488

Reputation: 227

Loop into a List in a Map using JSTL

Say I have a map like below

Map<String, Map<List<String>, Map<String,List<String>>> mapData= testMap();

request.setAttribute("mapData", mapData);

Now I want to access the highligted List and print the values using JSTL

I tried this

<c:forEach items="${mapData}" var="mapData">

    <c:forEach items="${mapData.value}" var="secondMapdata"> 

(I don't wanna loop through this map here, instead I only want to loop into List and print values)

Basically it should be like this (See highlighted text below)

<c:forEach items=**"${mapData.value.key}"** var="secondMapdata">

Upvotes: 0

Views: 362

Answers (1)

BalusC
BalusC

Reputation: 1108632

You need to add one more iteration level.

<c:forEach items="${mapData}" var="mapData">
    <c:forEach items="${mapData.value}" var="secondMapdata">
        <c:forEach items="#{secondMapdata.key}" var="listItem">

Upvotes: 1

Related Questions