我有一个 PopupPanel,里面有一个表格。该表单之前已由 ajax 渲染,因此由于 Richfaces 的一些问题/错误,我不得不将a4j:commandButton
表单放在带有execute
属性的外部。
当我点击按钮时,它会调用服务器但 bean 值没有更新。
有什么建议吗?
我的表单的简化代码:
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
[[[FORM FIELDS]]]
</h:form>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" execute="editWorkOrderForm" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</rich:popupPanel>
我的表格的完整代码:
<rich:popupPanel id="workOrderPopup" modal="true" resizeable="true"
onmaskclick="#{rich:component('workOrderPopup')}.hide()" width="750" height="420">
<h:form id="editWorkOrderForm" onkeypress="if (event.keyCode == 13) { document.getElementById('workOrderEdition:saveWO').click(); return false; }">
<table width="100%" id="editWorkOrderTable">
<tr>
<td>
<h:outputText value="ID" for="editedWOId"/><br/>
<h:inputText value="#{ticketCont.workOrder.id}" id="editedWOId" readonly="true" size="7"/>
</td>
<td>
<h:outputText value="Descripción" for="editedWODescription"/><br/>
<h:inputText value="#{ticketCont.workOrder.description}" id="editedWODescription"/>
</td>
<td>
<h:outputText value="Estado" for="editedWOState"/><br/>
<h:selectOneListbox value="#{ticketCont.workOrder.status}">
<f:selectItem itemLabel="Abierto" itemValue="0"/>
<f:selectItem itemLabel="Cerrado" itemValue="1"/>
</h:selectOneListbox>
</td>
<td>
<h:outputText value="Tiempo (en horas)" for="editedWOTime"/><br/>
<rich:inputNumberSpinner value="#{ticketCont.workOrder.workHours}" inputSize="4"/>
</td>
</tr>
<tr>
<td colspan="4">
<div align="center">
<h:outputText value="Recursos" for="editedWOResources"/><br/>
<rich:pickList value="#{ticketCont.workOrder.resources}" var="_resource" listHeight="200px" id="editedWOResources">
<f:selectItems value="#{ticketCont.activeResources}"/>
<f:converter converterId="es.caib.gesma.gesman.data.converter.ResourceConverter" />
<rich:column>
#{_resource.name}
</rich:column>
</rich:pickList>
</div>
</td>
</tr>
</table>
</h:form>
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}"
render="workOrders,footer" execute="editWorkOrderForm" oncomplete="#{rich:component('workOrderPopup')}.hide()"/>
</rich:popupPanel>
我正在使用 JBoss 6.1、Mojarra 2.1.9 和 Richfaces 4。