【发布时间】:2015-12-10 01:05:04
【问题描述】:
在 JSF 2.2 中编程时,我有时不确定update 语句是否有效。例如,我有下表,并希望在单击按钮时更新它:
<h:form id="theform">
<h:panelGroup id="entity">
<p:dataTable
var="item"
tableStyle="width:auto"
styleClass="tableFillRight"
value="#{artistEntityBean.asList}"
id="table">
<p:column headerText="Name">
<h:outputText value="#{item.name}" styleClass="tableArtistName" />
</p:column>
<f:facet name="footer">
<h:panelGroup id="footerWrapper">
<p:commandButton
id="requestMod"
partialSubmit="true"
process="@this"
value="become moderator"
update="@parent :messages"
disabled="#{moderatorEntityBean.item.moderatingArtist}"
actionListener="#{moderatorEntityBean.handleCreate()}"
action="#{artistEntityBean.init()}">
</p:commandButton>
</h:panelGroup>
</f:facet>
</p:dataTable>
</h:panelGroup>
</h:form>
由于按钮的ID 是theForm:table:requestMod,我认为update="@parent" 会起作用。但是,它似乎没有更新,或者我在支持 bean 的某个地方或其他地方犯了一个错误?
问题是:我现在不知道。因此,为了推断错误所在,最好以某种方式真正确保commandButton 的update 部分有效。
现在,当点击按钮时,更改的值仅在重新加载页面后更新。
【问题讨论】:
标签: jsf primefaces rerender