简体   繁体   English

如何在带有JSTL标签的JSP中获取Arralyst内部的element的值?

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

I wanted to get the value of each element which are inside of ArrayList which has been passed to JSP as a request.setAttribute. 我想获取ArrayList内每个元素的值,该元素已作为request.setAttribute传递给JSP。

When i write the next code I can get the value of each element wihtin the ArraList: 当我编写下一个代码时,我可以通过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>

However, I dont know how i can get the value directlly, with out foreach operation 但是,我不知道如何在没有foreach操作的情况下直接获得价值

Something like that: 像这样:

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

Could somebody tell me how can I manage c:out to get value from elements? 有人可以告诉我如何管理c:out以从元素中获取价值吗?

Something like 就像是

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

OR 要么

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM