【发布时间】:2019-07-31 18:06:04
【问题描述】:
在 jsf/primefaces(版本 6.2)项目中,我可以轻松地在手风琴中显示记录列表。
所有记录都正确显示。
在ui:repeat 中,我有一个p:commandButton 可以使用f:setPropertyActionListener 保存一些文本片段(fragmt)。
我还实现了第二个f:setPropertyActionListener 来获取对象(sRes)。这个工作正常。
但是currentFrag 变量总是会填充最后一个手风琴的文本片段。
<h:form id="accord" >
<p:accordionPanel value="#{myBean.lucSearchResults}" var="sRes" multiple="true">
<p:tab title="#{sRes.score}">
<ui:repeat value="#{sRes.frags}" var="fragmt">
<h:panelGrid columns="2" cellpadding="10">
<h:panelGrid columns="1" cellpadding="10">
<h:outputText value="#{fragmt}" escape="false"/>
<hr/>
</h:panelGrid>
<h:panelGrid columns="1" cellpadding="10">
<p:commandButton action="#{myBean.saveFrag}" value="Save" >
<f:setPropertyActionListener value="#{sRes}" target="#{myBean.currentSearchResult}" />
<f:setPropertyActionListener value="#{fragmt}" target="#{myBean.currentFrag}" />
</p:commandButton>
</h:panelGrid>
</h:panelGrid>
</ui:repeat>
</p:tab>
</p:accordionPanel>
</h:form>
我在 JSF 和 Java 方面拥有丰富的经验。我对这种奇怪的行为没有任何解释。
非常感谢有关此问题的任何帮助或指示。
【问题讨论】:
标签: primefaces jsf-2.2