2012-07-24 71 views
1

我有一個帶有窗體的PopupPanel。該表單以前是由ajax渲染的,所以通過richfaces的一些問題/錯誤,我不得不將a4j:commandButton置於表單之外,並使用execute屬性。未使用Ajax更新Bean值

當我點擊按鈕時,它調用服務器,但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,鑽嘴魚科2.1.9和RichFaces的4

回答

2

我認爲問題不在於此代碼,而是從其他單擊您的editWorkOrderForm渲染的問題,因爲你從不工作... 因爲你可以這樣做..

<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; }"> 
     <a4j:outputpanal id="editWorkOrderPanal"> 
     <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> 
<a4j:commandButton id="createWO" value="Guardar" action="#{ticketCont.saveWorkOrder()}" 
       render="workOrders,footer" oncomplete="#{rich:component('workOrderPopup')}.hide()"/> 
</a4j:outputPanal> 
     </h:form> 
    </rich:popupPanel> 

現在點擊彈出是render="editWorkOrderPanal"開有這工作4 U ..

+2

好吧,這個當過我喜歡。 – SJuan76 2012-07-24 10:27:45