簡體   English   中英

如何在帶有JSTL標簽的JSP中獲取Arralyst內部的element的值?

[英]How can I get the value of element which inside of an Arralyst in my JSP with JSTL tag?

我想獲取ArrayList內每個元素的值,該元素已作為request.setAttribute傳遞給JSP。

當我編寫下一個代碼時,我可以通過ArraList獲得每個元素的值:

  <table border="1">
  <c:forEach var="item"  items="${ListCompanies}">
  <td><b><c:out value="${item.string2}"/></b></td>
  <td><b><c:out value="${item.string3}"/></b></td>
  </c:forEach>
  </table>

但是,我不知道如何在沒有foreach操作的情況下直接獲得價值

像這樣:

<c:out value="${ListCompanies.string2}"/>

有人可以告訴我如何管理c:out以從元素中獲取價值嗎?

就像是

<c:out value="${ListCompanies[0].string2}" />

要么

<c:out value="${ListCompanies[1].string3}" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM