<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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM