JSF-< ui:repeat/>在java.util.Set上? [英] JSF -- <ui:repeat /> over a java.util.Set?
本文介绍了JSF-< ui:repeat/>在java.util.Set上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<ui:repeat />
标记是否支持对java.util.Set
进行迭代?我尝试遍历Set中包含的JPA域实体对象,但收到错误.有什么我想念的吗?是否需要显示其他标志?
Does the <ui:repeat />
tag support iterating over a java.util.Set
? I've tried iterating over my JPA domain entity objects contained in a Set, but receive errors. Is there something I'm missing? Does an additional flag need to be present or something?
推荐答案
不,ui:repeat
不支持Set,h:dataTable
也不支持.
No, the ui:repeat
does not support Set, nor does h:dataTable
.
您应该从集合中返回一个列表,并使用它.
You should return a List from the Set, and use that instead.
public List<T> getListFromSet(Set<T> set) {
return new ArrayList<T>(set);
}
您应避免使用c:forEach
; 此处是有关原因的文章.
这篇关于JSF-< ui:repeat/>在java.util.Set上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文