EL 表达式

逻辑运算

image-20210622100342019
  1. jsp 中通过 EL 表达式展示 request 或 session 域中某对象成员变量的值,要求对象中成员变量全部为 String 类型,否则会出现序列化错误的问题

    示例:

    1
    2
    ${eventDto.xxx}
    //类 EventDto 中所有成员变量均须为 String
  2. Boolean

    Java:

    1
    request.setAttribute("supportReject", true);

    JSP:

    1
    2
    3
    <c:if test="${supportReject}">

    </c:if>
  3. 比较运算

    1
    2
    3
    4
    5
    <c:if test="${deptlevel == '6'}">
    </c:if>

    <c:if test="${deptlevel != '6'}">
    </c:if>