el表达式的if else用法 随便记录下

el表达式要想使用if else 必须得用<c:choose></c:choose>标签

比如

<c:choose>

    <c:when test="${not empty getchecknum}">

    如果getchecknum对象不为空 如何如何

   </c:when>

   <c:otherwise>

     否则如何如何

  </c:otherwise>

</c:choose>

 

例子

<form id="searchForm" method="post">
    <div class="tab">      
           <h3>审批意见</h3>
        <p><textarea rows="" cols="" placeholder="请输入审批意见..." id="remarks" required name="remarks" class="tab-content"></textarea></p>
    </div>
        <c:choose>
            <c:when test="${not empty getchecknum}">
                <div style="margin-bottom: 20px;">
                    <label for="operator">经办人:</label> 
                    <input id="operator" name="operator" value="${getchecknum.operator }">
                    <label for="operatorPhone" style="margin-left: 40px;">经办人电话:</label>
                    <input id="operatorPhone" name="operatorPhone" value="${getchecknum.operator_phone }" class="number"> 
                    <label for="operatorQq" style="margin-left: 40px;">经办人QQ:</label>
                    <input id="operatorQq" name="operatorQq" value="${getchecknum.operator_qq }">
                </div>
            </c:when>
            <c:otherwise>
                <div style="margin-bottom: 20px;">
                    <label for="operator">经办人:</label> <input id="operator"
                        name="operator" value="${loginUser.name }"> <label
                        for="operatorPhone" style="margin-left: 40px;">经办人电话:</label> <input
                        id="operatorPhone" name="operatorPhone"
                        value="${loginUser.phone }"> <label
                        for="operatorQq" style="margin-left: 40px;">经办人QQ:</label> <input
                        id="operatorQq" name="operatorQq"
                        value="">
                </div>
            </c:otherwise>
        </c:choose>
    </form>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值