This is my java code which creates a multidimensional hashmap:
HashMap<String, HashMap<String, String>> data = new HashMap<String, HashMap<String, String>>();
for (App app : apps) {
String randomVar = "";
data.put(String.valueOf(app.getId()), new HashMap<String, String>());
data.get(String.valueOf(app.getId())).put("name", app.getName());
data.get(String.valueOf(app.getId())).put("info", randomVar);
}
This is my .jsp
file:
<c:forEach items="${data}" var="items">
<c:forEach items="${items}" var="item">
<div class="col-md-6">
<div class="overview">
<a href="/goto/${items.key}" class="minimal" title="Switch to: ${item.name}">
${item.randomVar}
<span>${item.name}</span>
</a>
</div>
</div>
</c:forEach>
</c:forEach>
Unfortunately, I can't make the loop in the jsp file work. The problem is with the second loop. I can't reach the variables. Whatever I try, I get errors like Don't know how to iterate over supplied 'items' in <forEach>
or that items.name
doesn't exist and so on. How can I properly loop the hashmap?