Reputation: 71
I have a consultation table for doctors and when I log in with a doctors account I only want to display the consultations for that specific doctor. In my jsp page I tried the following, but with no luck:
<c:forEach var="consultation" items="${consultations}">
<c:if test = "${consultation.user.lastName == '${user.lastName}'}">
<tr>
<td><c:out value="${consultation.patient.name}" /></td>
<td><c:out value="${consultation.user.lastName} ${consultation.user.firstName}" /></td>
<td><c:out value="${consultation.date}" /></td>
<td><c:out value="${consultation.time}" /></td>
<td><c:out value="${consultation.details}" /></td>
<td><c:out value="${consultation.prescription}" /></td>
</tr>
</c:if>
</c:forEach>
But the comparison
is not working. How can I do such a test?
Upvotes: 0
Views: 51
Reputation: 19445
You should really put this logic in the java code (servlet, struts action, etc) that populates the "consultations" list.
But to answer your question specifically, try:
<c:if test = "${consultation.user.lastName == user.lastName}">
Upvotes: 1