1 Reply Latest reply on Aug 19, 2007 11:00 AM by damianharvey

    ajax4jsf+seam2.0+conversation prob

    mrohad

      ok , sorry for the mess in my last msg

      here is my prob:
      I've a datatTable (I'm getting the rows from EntityQuery)
      when I click on a row I open a modalPanel with the fields
      the fields are bind to EntityHome and onRowClick I set the Entityhome Id using ajax:support
      everything works so far
      now I am editing the fields and click on ajax:commandButton and calling the action EntityHome.update and when I'm debuggin I can see none of the fields in the EntityHome.instance got updated.

      I've no idea why the fields never get updated...
      any clue???

      thank u

      here is my XHTML:

      <?xml version="1.0" encoding="Windows-1255" ?>
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       template="/layout/template.xhtml">
      
       <ui:define name="body">
      
       <h:messages globalOnly="true" styleClass="message" id="globalMessages" />
       <rich:panel id="customerTable">
       <f:facet name="header">table</f:facet>
       <div class="results" id="customerList">
      
       <a4j:region >
       <rich:dataTable
       onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       id="customerListTable" var="customer" value="#{customerList.customers}"
       rowKey="#{customer.id}" rowKeyVar="custId" >
      
      
       <rich:column>
       <f:facet name="header">
       <s:link styleClass="columnHeader"
       value="id #{customerList.order=='id asc' ? messages.down : ( customerList.order=='id desc' ? messages.up : '' )}">
       <f:param name="order"
       value="#{customerList.order=='id asc' ? 'id desc' : 'id asc'}" />
       </s:link>
       </f:facet>
       #{customer.id}
       </rich:column>
       <rich:column>
       <f:facet name="header">
       <s:link styleClass="columnHeader"
       value="name #{customerList.order=='name asc' ? messages.down : ( customerList.order=='name desc' ? messages.up : '' )}">
       <f:param name="order"
       value="#{customerList.order=='name asc' ? 'name desc' : 'name asc'}" />
       </s:link>
       </f:facet>
       #{customer.name}
       </rich:column>
      
       <a4j:support event="onRowClick"
       oncomplete="javascript:Richfaces.showModalPanel('custForm:panel')"
       reRender="panel" data="#{rowKey}"
       actionListener="#{customerHome.selectCustomerFromTable}">
       <s:conversationId/>
       <a4j:actionparam name="cust" id="cust" assignTo="#{customerHome.id}" value="#{customer.id}"/>
       </a4j:support>
      
       </rich:dataTable>
       </a4j:region>
       </div>
       </rich:panel></a4j:form>
      
      
      
      
      
      
       <!-- POPUP -->
       <a4j:region id="popupregion">
       <a4j:form id="custForm">
       <rich:modalPanel id="panel" width="400" height="400">
       <f:facet name="header">
       <h:outputText value="edit customer" />
       </f:facet>
      
       <h:panelGrid columns="1">
       <s:decorate template="/layout/display.xhtml">
       <ui:define name="label">id</ui:define>
       <h:inputText id="custId" value="#{customerHome.instance.id}" />
       </s:decorate>
       <s:decorate template="/layout/display.xhtml">
       <ui:define name="label">name</ui:define>
       <h:inputText id="name" value="#{customerHome.instance.name}" />
       </s:decorate>
      
      
       <a4j:commandButton id="updateCustomerButton" reRender="customerListTable" action="#{customerHome.update}" ajaxSingle="true" value="UPDATE"
       oncomplete="javascript:Richfaces.hideModalPanel('custForm:panel')" >
       <s:conversationId/>
       </a4j:commandButton>
       <h:commandButton onclick="javascript:Richfaces.hideModalPanel('custForm:panel')" value="close"></h:commandButton>
       </h:panelGrid>
      
       </rich:modalPanel>
       </a4j:form>
       </a4j:region>
      
      
       </ui:define>
      </ui:composition>
      

      here is my EntityHome:
      package com.metalogic.superfine.entity;
      
      import java.util.ArrayList;
      import java.util.List;
      
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import javax.faces.event.ActionEvent;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Begin;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.framework.EntityHome;
      @Scope(ScopeType.CONVERSATION)
      @Name("customerHome")
      @Stateful
      public class CustomerHome extends EntityHome<Customer> implements LocaLCustomerHome{
       @Override
       public Customer getInstance() {
       // TODO Auto-generated method stub
       return super.getInstance();
       }
       @Remove
       public void destroy() {}
       public void setCustomerId(String id) {
       setId(new Integer(id));
       }
      
       public Integer getCustomerId() {
       return (Integer) getId();
       }
      
       @Override
       protected Customer createInstance() {
       Customer customer = new Customer();
       return customer;
       }
      
       public void wire() {
       }
      
       public boolean isWired() {
       return true;
       }
      
       public Customer getDefinedInstance() {
       return isIdDefined() ? getInstance() : null;
       }
      
       public List<CustomerAccounting> getCustomerAccountings() {
       return getInstance() == null
       ? null
       : new ArrayList<CustomerAccounting>(getInstance()
       .getCustomerAccountings());
       }
       public List<Invoice> getInvoices() {
       return getInstance() == null ? null : new ArrayList<Invoice>(
       getInstance().getInvoices());
       }
       public List<CustomerConnection> getCustomerConnections() {
       return getInstance() == null
       ? null
       : new ArrayList<CustomerConnection>(getInstance()
       .getCustomerConnections());
       }
       @Begin(join=true)
       public void selectCustomerFromTable(ActionEvent event){
       setId(new Integer(getId().toString()));
       }
      
       @Override
       public String update() {
       System.out.println("UPDATE");
       return super.update();
       }
      
      
      }