在 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 的某个地方或其他地方犯了一个错误?
问题是:我现在没有。因此,为了推断错误所在,以某种方式真正确保update
部分commandButton
工作正常会很棒。
现在,当单击按钮时,更改的值仅在重新加载页面后更新。