EL判断语句
<!-- currentRoleId是存在request域中的、sysAdmin是存在application域中的,即servletContext中 -->
<c:if test="${empty currentRoleId}">
currentRoleId为空
</c:if>
<c:if test="${not empty currentRoleId}">
currentRoleId不为空
</c:if>
<!-- 判断两者是否相等 -->
<c:if test="${requestScope.currentRoleId eq applicationScope.sysAdmin}">
currentRoleId和sysAdmin相等
</c:if>
<!-- 在这里就不是和empty一样了,在这里el表达式不相等不像判断是否为空那样,不为空是not empty,在这里不相等不是not eq,表示不相等应如下所示的取反操作 -->
<c:if test="${!(requestScope.currentRoleId eq applicationScope.sysAdmin)}">
currentRoleId和sysAdmin不相等
</c:if>
<!-- 不使用jstl判断,使用三目表达式输出 -->
${!(requestScope.currentRoleId eq applicationScope.sysAdmin) ? "两者不相等" : "两者相等"}
${not empty currentRoleId ? "不为空" : "为空"}