I’m a bit lost on how to do this properly, I am sending a variable to my model in Spring that is like this:
Map<Integer, Tab2WorkTableDocumentCounts> finalJspList = new HashMap<Integer, Tab2WorkTableDocumentCounts>();
Where Tab2WorkTableDocumentCounts is a simple object like this (with getters and setters)
public class Tab2WorkTableDocumentCounts {
private Integer countTier1;
private Integer countTier2;
private Integer countTier3;
private Integer countTier4;
private Integer countTier5;
}
So finalJspList is a hashmap containing a series of objects with a getter method that I am trying to call. I am trying like below but its giving a syntax error in the IDE. I want to call the method like getCountTier1() for each entry.value in the hashmap and display it as HTML
Any advice to help me clear this up would be appreciated.
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:forEach items="${finalJspList}" var="finalJspList">
<ul class="cust">
<li class="cust-name">${entry.key}</li>
<li class="lvl-1">${fn:entry.value().getCountTier1()}</li>
<li class="lvl-2 completed">${fn:entry.value().getCountTier2()}</li>
<li class="lvl-3">${fn:entry.value().getCountTier3()}</li>
<li class="lvl-4">${fn:entry.value().getCountTier4()}</li>
<li class="lvl-5">${fn:entry.value().getCountTier5()}</li>
<li class="export"><a href="#"><img src="http://www.liquisdesign.com/stage/jfit/images/export-icon.png" width="20px"></a></li>
</ul>
</c:forEach>
${entry.value.countTier1}var="entry"(instead offinalJspList)fn:Technically, getters would work with the latest version of EL, but the code looks cleaner if you just use the property names.