【发布时间】:2011-05-04 20:29:57
【问题描述】:
我在同一页面上的几个 h:dataTables 中呈现包含自定义对象 (POJO) 的 ArrayList (menu.specifications)。每个 h:dataTable 都包含不同范围的 ArrayList 元素。一列包含一个 h:inputText 标记。
用户输入提交后,只更新最后一个dataTable的inputText标签。其他 保持不变。
以下是相关代码:
<h:form>
<ui:repeat value="#{menu.groupTitles}" var="element" varStatus="loop">
<h:dataTable rendered="#{menu.points[loop.index].y>0}" value="#{menu.specifications}"
first="#{menu.points[loop.index].x}" rows="#{menu.points[loop.index].y}" var="rowVar" border="1">
<h:inputText value="#{rowVar.pvalue}" id="pvalue"/>
我也试过了:
<h:inputText value="#{menu.specifications[rowVar.index].pvalue}" id="pvalue"/>
参考说明:
-
menu.points[loop.index].x= 要在数据表中显示的 ArrayList 的第一个元素 -
menu.points[loop.index].y= 要在数据表中显示的元素数 -
menu.groupTitles= 不同数据表的标题
【问题讨论】:
标签: jsf-2