一、EL通过“==”判断两个对象相等;
二、EL通过<c:choose>中的<c:when> <c:otherwise>,相当于 if,else。
<c:choose>
<!-- "c:when",相当于if-->
<c:when test="">
</c:when>
<!-- "c:otherwise",相当于else-->
<c:otherwise>
</c:otherwise>
</c:choose>
例子:
<c:choose>
<!--"!=",表示两个对象不相等-->
<c:when test="${pojo.attribute009 != pojoPre.attribute009}">
<td>
<span><font color="red">管理部门</font></span>
</td>
</c:when>
<!-- "c:otherwise",相当于else-->
<c:otherwise>
<td>
<span>管理部门</span>
</td>
</c:otherwise>
</c:choose>
效果:
两个对象 pojo 和 pojoPre 的属性 attribute009 值不同,将属性名称 “管理部门” 变为红色。