更新时间:2023-02-26 16:25:00
您可以使用ui:repeat
代替c:forEach
,我尝试了一个示例,它很适合我. c:foreach
是一个标记处理程序,请查看@BalusC的以下帖子,以了解有关为什么不应该将标记处理程序用于视野范围的bean的更多信息.
You can use ui:repeat
instead of c:forEach
, I tried myself with a sample and it worked for me. c:foreach
is a tag-handler and please take a look at the following post of @BalusC to learn more about why you should not use tag handlers with view-scoped beans.
<table>
<ui:repeat value="#{sampleBean.twodarray}" var="firstLevel" varStatus=#{vs}>
<tr>
<ui:repeat value="#{firstLevel}" var="secondLevel" rendered="#{!empty firstLevel}">
<td>#{vs.index} - #{secondLevel}</td>
</ui:repeat>
<h:panelGroup rendered="#{empty firstLevel}">
<td colspan="3">empty</td>
</h:panelGroup>
</tr>
</ui:repeat>
</table>