2 Replies Latest reply on Aug 2, 2008 5:52 PM by Piotr Jatym

    Rerender won't work

    Piotr Jatym Newbie

      Hi
      I'm new to richfaces.
      I've got page with three forms, in third I got a repeater with button for every row. Button click deletes value and makes rerender, but nothing heppends.

      Code of form:


      <a4j:form id="form2">
       <a4j:outputPanel id="abonamentListOutputPanel">
       <t:div id="abonamentListDiv" rendered="#{personEditBean.deletable}"
       styleClass="insideBox_2">
       <br />
       <h:outputText value="Wykupione Abonament" />
       <br />
       <table>
       <tr>
       <td>Nazwa</td>
       <td>Data od</td>
       <td>Data do</td>
       <td>Akcja</td>
       </tr>
       <a4j:repeat id="purchasedAbonamentsRepeater"
       value="#{personEditBean.person.purchasedAbonaments}"
       var="listObj">
       <tr>
       <td><h:outputText value="#{listObj.abonament.name}" /></td>
       <td><h:outputText value="#{listObj.dateFrom}" /></td>
       <td><h:outputText value="#{listObj.dateTo}" /></td>
       <td><a4j:commandButton
       id="deletePurchasedAbonament_"
       action="#{personEditBean.deletePurchasedAbonament}"
       value="Delete" reRender="abonamentListOutputPanel"
       >
       <f:param name="purchasedAbonament_id" value="#{listObj.id}" />
       </a4j:commandButton></td>
       </tr>
       </a4j:repeat>
       </table>
       </t:div>
       </a4j:outputPanel>
       </a4j:form>
      


      Hibernate logs shows something interesting - first select for repeater begins, after that hibernate deletes.

      Method code:
      public void deletePurchasedAbonament() {
       String purchasedAbonament_id = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()
       .get("purchasedAbonament_id");
      
       Long abonamentToDelId = Long.valueOf(purchasedAbonament_id);
       Session session = HibernateUtil.getSessionFactory().getCurrentSession();
       session.beginTransaction();
       PurchasedAbonament tempPA = (PurchasedAbonament) session.load(PurchasedAbonament.class, abonamentToDelId);
       session.delete(tempPA);
       session.getTransaction().commit();
      
       }
      


      Any idea whats wrong ?

      Regards