小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

jsp jstl c標簽 list map

 一本正經(jīng)地胡鬧 2019-08-26

${list[0].username}<br>

${list[1].username}<br>

${list[2].username}<br>

<%List<TestUser> list = (List)request.getAttribute("list"); %><br>

username:<%=list.get(0).getUsername() %><br>

<c:forEach items="${list }" var="person">

c標簽username:${person.username }<br>

</c:forEach>


${map.person1.username}<br>

${map["person2"].username }<br>

${map["1"].username }<br>

<c:if>和<c:when>

<c:if>沒有<c:else>可以用<c:choose>來取代結構:

<c:choose>

   <c:when test="">    如果

   </c:when>

   <c:otherwise>  否則

   </c:otherwise>

</c:choose>

在同一個 <c:choose> 中,當所有 <c:when> 的條件都沒有成立時,則執(zhí)行 <c:otherwise> 的本體內(nèi)容。

  語法

  <c:otherwise>

  本體內(nèi)容

  </c:otherwise>

  屬性

  無

  限制

  ·<c:otherwise> 必須在 <c:choose> 和 </c:choose>之間

  ·在同一個 <c:choose> 中時,<c:otherwise> 必須為最后一個標簽

  說明

  在同一個 <c:choose> 中,假若所有 <c:when> 的test屬性都不為true時,則執(zhí)行 <c:otherwise> 的本體內(nèi)容。

  范例

  筆者舉一個典型的 <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>成立。


    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多