java - JSP页面中的 vector

标签 java jsp

如何在 JSP 页面中迭代 vector ?

我做到了:

<%
 Vector value = (Vector) request.getAttribute("status");
 for (Enumeration e = value.elements(); e.hasMoreElements(); )
 {
        StatusItem myStatus = (StatusItem) e.nextElement();

 }
%> 

有什么办法可以用jsp标签来做吗? 谢谢

最佳答案

像这样打印出 vector 的内容:

<c:foreach var="myStatus" items="${status}" >
  <!-- print out the value of each status in the vector.
       Method getValue() must exist in the status class.-->
  <c:out value="${myStatus.value}"/>
</c:foreach>

关于java - JSP页面中的 vector ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3820624/

相关文章:

java - ClassNotFoundException : org. hibernate.ejb.HibernatePersistence 使用 maven 部署

jquery - 按钮作为取消重定向到上一页

java - 是否可以在 WebSphere Application Server 上自动运行 Java 应用程序?

mysql - 如何使用jsp从excel(apache poi)中提取数据并将其放入mysql表中?

java - 如何使 JToolBar 自动隐藏?

java - 如何在 Java 中发送 SOAP 请求头?

java - 如何终止SwingWorker创建的所有正在运行的线程?

java - 是否有类似 jQuery 的选择器用于 XML 解析?

java - getSession().getAttribute ("....") -> null

java - 是否应该使用 session 来处理表单验证的错误消息?