如何检查JSP中的字段内容

时间:2017-06-02 20:42:10

标签: jsp jstl

我有桌子:

<c:forEach var="employee" items="${employees}">
    <tr>
        <td>${employee.id}</td>
        <td>${employee.gender.gender}</td>
        <td>${employee.name}</td>
        <td>${employee.surname}</td>
        <c:if test="${employee.appointment.appointment eq NAVIGATOR}">//Checking value of field
            <td>${employee.appointment.appointment}</td>
        </c:if>
    </tr>
</c:forEach>

我想检查字段的值:

$ {employee.appointment.appointment}

怎么做?

1 个答案:

答案 0 :(得分:0)

如果您要检查员工的价值,您需要将NAVIGATOR放在引号中,例如&#39; NAVIGATOR&#39 ;.appointment.appointment实际上是NAVIGATOR。

<c:if test="${employee.appointment.appointment eq 'NAVIGATOR'}">
      <td>${employee.appointment.appointment}</td>
</c:if>