I have two arraylists that I have passed to my JSP. I can loop through and display their values separately, as in
<c:forEach var="Headr" items="${requestScope.listHeadrs}">
<c:out value="${Headr.headrid}"/> :
<c:out value="${Headr.headr}"/> :
<c:out value="${Headr.headrdescr}"/><br>
</c:forEach>
<c:forEach var="Funct" items="${requestScope.listFuncts}">
<c:out value="${Funct.functid}"/>,
<c:out value="${Funct.funct}"/>,
<c:out value="${Funct.functheadr}"/>,
<c:out value="${Funct.functdescr}"/><br>
</c:forEach>
However, I am trying to loop through both, to find the instances where the value from one (${Headr.headr}) matches a value from the other, (${Funct.functheadr}).
I tried the following, but get errors on the 'if' statement:
<c:forEach var="Headr" items="${requestScope.listHeadrs}">
<c:forEach var="Funct" items="${requestScope.listFuncts}">
<c:if test="${Funct.functheadr}" == "${Headr.headr}">
<c:out value="${Funct.funct}"/>
</c:if>
</c:forEach>
</c:forEach>
Any ideas how this might be accomplished?
The compile errors (Eclipse) are as follows: Multiple annotations found at this line: - Missing required attribute "test" - Undefined attribute name "Headr.headr" - Undefined attribute name "eq" - Undefined attribute name "$ {Funct.functheadr}" - Invalid location of text (}) in tag (<c:if>). - Invalid location of text (${) in tag (<c:if>). - Invalid location of text (") in tag (<c:if>). - Invalid location of text (== ") in tag (<c:if>).