Reputation: 2632
I'm comparing two different values each from different list using JSTL tag, but I keep getting the error. I tried to change the brackets associated with it, but none worked. I searched for comparing two list values in JSTL, but none helps me.
<c:forEach items="${commentsList}" var="commentsList">
<c:choose>
<c:when test="${ ${commentsList.user.id} == '${blog.user.id}' }">
<li>
<div class="timeline-panel" style="float:right">
<div class="timeline-heading" align="left">
<b>${commentsList.user.firstName} ${commentsList.user.lastName}</b>
</div><hr>
<div class="timeline-body" style="float: right;">
<p>${commentsList.comment}</p>
</div>
</div>
</li>
</c:when>
<c:otherwise>
<li class="timeline-inverted">
<div class="timeline-panel">
<b>${commentsList.user.firstName} ${commentsList.user.lastName}</b><hr>
<div class="timeline-body">
<p>${commentsList.comment}</p>
</div>
</div>
</li>
</c:otherwise>
</c:choose>
</c:forEach>
Error is
"${ ${commentsList.user.id} == '${blog.user.id}' }" contains invalid expression(s): javax.el.ELException: Error Parsing: ${ ${commentsList.user.id} == '${blog.user.id}' }
I've not compared two list values before, btw I can compare two list values in jstl right?
Upvotes: 1
Views: 2243
Reputation: 28569
You should change to
<c:when test="${commentsList.user.id eq blog.user.id}">
Upvotes: 1
Reputation: 2907
there is an extra $
.
try this:
<c:when test="${ commentsList.user.id eq blog.user.id}">
Upvotes: 2