简体   繁体   English

遍历列表中带有JavaScript丰富字体的项目

[英]Iterate through items in a list with richfaces in javascript

Is there a way, in richfaces preferably, to access a Java collection object and loop through the items in a java-script function? 有没有办法在richfaces中访问Java集合对象并循环遍历java脚本函数中的项目?

I know richfaces dataTables can access the property and create rows based on each item in the list, but I can't figure out how to replicate that same functionality in a java-script method. 我知道richfaces dataTables可以访问属性并根据列表中的每个项创建行,但我无法弄清楚如何在java-script方法中复制相同的功能。

The reason for this, is I need to build an array of object literals, with each object corresponding to a item in the list. 这样做的原因是,我需要构建一个对象文字数组,每个对象对应于列表中的一个项目。

You can use jstl core library to Iterate through List: 您可以使用jstl核心库遍历List:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:forEach var="item" items="${bean.items}">
  alert(${item.someField);
</c:forEach>

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

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