zoukankan      html  css  js  c++  java
  • <c:otherwise>

    <c:if>没有<c:else>可以用<c:choose>来取代结构:
    <c:choose>

       <c:when test="">    如果
       </c:when>
       
       <c:otherwise>  否则
       </c:otherwise>
    </c:choose>

    在同一个 <c:choose> 中,当所有 <c:when> 的条件都没有成立时,则执行 <c:otherwise> 的本体内容。

      语法

      <c:otherwise>

      本体内容

      </c:otherwise>

      属性

      无

      限制

      ·<c:otherwise> 必须在 <c:choose> 和 </c:choose>之间

      ·在同一个 <c:choose> 中时,<c:otherwise> 必须为最后一个标签

      说明

      在同一个 <c:choose> 中,假若所有 <c:when> 的test属性都不为true时,则执行 <c:otherwise> 的本体内容。

      范例

      笔者举一个典型的 <c:choose>、<c:when>和<c:otherwise>范例:

      <c:choose>

      <c:when test="${condition1}">

      condition1为true

      </c:when>

      <c:when test="${ condition2}">

      condition2为true

      </c:when>

      <c:otherwise>

      condition1和condition2都为false

      </c:otherwise>

      </c:choose>

      范例说明:当condition1为true时,会显示“condition1为true”;当condition1为false且condition2为true时,会显示“condition2为true”,如果两者都为false,则会显示“condition1和condition2都为false”。

      注意

      假若condition1和condition2两者都为true时,此时只会显示"condition1为true",这是因为在同一个<c:choose>下,当有好几个<c:when>都符合条件时,只能有一个<c:when>成立。

    <c:if
                            test="${vMgrCustAssetList != null && fn:length(vMgrCustAssetList) > 0 }">
                            <c:forEach var="vMgrCustAsset" items="${vMgrCustAssetList}">
                                <tr class="master1"
                                    onclick="javascript:window.location.href='${ctx}/custHeld!toCustDetailInfo.do?cId=${vMgrCustAsset.cid}'">
                                    <td>${vMgrCustAsset.custName}</td>
                                    <td><c:choose>
                                            <c:when test="${vMgrCustAsset.riskLevel == '1'}">安逸型</c:when>
                                            <c:when test="${vMgrCustAsset.riskLevel == '2'}">保守型</c:when>
                                            <c:when test="${vMgrCustAsset.riskLevel == '3'}">稳健型</c:when>
                                            <c:when test="${vMgrCustAsset.riskLevel == '4'}">平衡性型</c:when>
                                            <c:when test="${vMgrCustAsset.riskLevel == '5'}">成长型</c:when>
                                            <c:when test="${vMgrCustAsset.riskLevel == '6'}">进取型</c:when>
                                            <c:otherwise>未知</c:otherwise>
                                        </c:choose></td>
                                    <td>${vMgrCustAsset.phoneNumber}</td>
                                    <td><fmt:formatNumber value="${vMgrCustAsset.totalAsset}" groupingUsed="true" maxFractionDigits="2"></fmt:formatNumber></td>
                                    <td></td>
                                </tr>
                            </c:forEach>
                        </c:if>
  • 相关阅读:
    jQuery-遍历
    jQuery-尺寸方法
    jQuery-操作css类
    jQuery-添加/删除元素
    jQuery捕获-获取DOM元素内容和属性
    Props属性
    jQuery事件
    jQuery选择器
    JQ基本选择器
    注册事件
  • 原文地址:https://www.cnblogs.com/mingforyou/p/4468163.html
Copyright © 2011-2022 走看看