I've got a Map object in my session with a UDO (User Defined Object) as a key and a list of that same object as value. I'm trying to iterate through this map using jstl and printing it as navbar, but apparently it's like the jstl code is not going through pieces of code as if the variables were not correctly set. The problem is that the navbar doesn't get printed at all, and specifically it doesn't even get into the "include subMenu.jsp" part.
Edit: Apparently the problem is with the c:if that just doesn't let the code get in the if clause although the "menu" attribute in that specific moment isn't null! So probably I'm writing the if clause wrong... but where and how?
This is my code:
<nav role="navigation">
<ul>
<c:forEach items="${sessionScope.menuNav}" var="menu">
<c:if test="${menu.key != null}">
<c:if test="${menu.value != null}">
<li><a href="#"><c:out value="${menu.key.getTitle()}"></c:out></a>
<ul class="dropdown">
<c:set var="subMenu" value="${menu.value}" scope="request"/>
<jsp:include page="subMenu.jsp"/>
</ul>
</li>
</c:if>
</c:if>
</c:forEach>
</ul>
</nav>
This is the subMenu.jsp
<c:forEach items="${subMenu}" var="subMenu">
<c:if test="${subMenu.subMenu == null}">
<li><a href="${subMenu.getPage()}"><c:out value="${subMenu.getTitle()}"></c:out></a></li>
</c:if>
<c:if test="${subMenu.subMenu != null}">
<li><a href="#"><c:out value="${subMenu.getTitle()}"></c:out></a>
<ul class="dropdown-submenu">
<c:set var="subMenu" value="${subMenu.getSubMenu()}" scope="request"/>
<jsp:include page="subMenu.jsp"/>
</ul>
</li>
</c:if>
</c:forEach>
I perfectly manage to put the mapObejct in session. I know because I've run through every single step in debug mode. But I still don't get what part I'm getting wrong. The object is conventionally built (with correctly named getters and setters etc.). This is what I see in debug mode:
The attribute of the session is correctly loaded... I've tried to look for some solutions around but nothing that really helped me... What am I getting wrong?
Edit: This is my Map definition:
Map<InvoiceModel, List<InvoiceModel>> menuMap =
new HashMap<InvoiceModel, List<InvoiceModel>>();
This is my InvoiceModel Object:
public class InvoiceModel {
private String title;
private String page;
private List<String> roles;
private List<InvoiceModel> subMenu;
//Getters and setters
}