[jboss-user] [JBoss Seam] - Re: ajax and EntityHome (Conversation) bug?!

mrohad do-not-reply at jboss.com
Sat Aug 18 06:30:42 EDT 2007


yes I do..

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" />
  | 		<!-- FILTER -->
  | 		<a4j:form id="customerSearch" styleClass="edit" dir="rtl">
  | 			<rich:simpleTogglePanel label="     ????? ??????        "
  | 				switchType="client" style="direction:rtl">
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">??</ui:define>
  | 					<h:inputText id="name" value="#{customerList.customer.name}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?? ???</ui:define>
  | 					<h:inputText id="shortName"
  | 						value="#{customerList.customer.shortName}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?????</ui:define>
  | 					<h:inputText id="address" value="#{customerList.customer.address}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?????2</ui:define>
  | 					<h:inputText id="address2"
  | 						value="#{customerList.customer.address2}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?????</ui:define>
  | 					<h:inputText id="phoneNumber"
  | 						value="#{customerList.customer.phoneNumber}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">????? 2</ui:define>
  | 					<h:inputText id="phoneNumber2"
  | 						value="#{customerList.customer.phoneNumber2}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">???</ui:define>
  | 					<h:inputText id="fax" value="#{customerList.customer.fax}" />
  | 				</s:decorate>
  | 
  | 			</rich:simpleTogglePanel>
  | 
  | 			
  | 
  | <div class="actionButtons">
  | 			<a4j:commandButton
  | 				reRender="customerTable" value="?????" /></div>
  | 
  | 
  | 		<rich:panel id="customerTable">
  | 			<f:facet name="header">??????</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="??? #{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="?? #{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>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						<s:link styleClass="columnHeader"
  | 							value="?? ??? #{customerList.order=='shortName asc' ? messages.down : ( customerList.order=='shortName desc' ? messages.up : '' )}">
  | 							<f:param name="order"
  | 								value="#{customerList.order=='shortName asc' ? 'shortName desc' : 'shortName asc'}" />
  | 						</s:link>
  | 					</f:facet>
  |             #{customer.shortName}
  |         </rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						<s:link styleClass="columnHeader"
  | 							value="????? #{customerList.order=='address asc' ? messages.down : ( customerList.order=='address desc' ? messages.up : '' )}">
  | 							<f:param name="order"
  | 								value="#{customerList.order=='address asc' ? 'address desc' : 'address asc'}" />
  | 						</s:link>
  | 					</f:facet>
  |             #{customer.address}
  |         </rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						<s:link styleClass="columnHeader"
  | 							value="?????2 #{customerList.order=='address2 asc' ? messages.down : ( customerList.order=='address2 desc' ? messages.up : '' )}">
  | 							<f:param name="order"
  | 								value="#{customerList.order=='address2 asc' ? 'address2 desc' : 'address2 asc'}" />
  | 						</s:link>
  | 					</f:facet>
  |             #{customer.address2}
  |         </rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						<s:link styleClass="columnHeader"
  | 							value="????? #{customerList.order=='phoneNumber asc' ? messages.down : ( customerList.order=='phoneNumber desc' ? messages.up : '' )}">
  | 							<f:param name="order"
  | 								value="#{customerList.order=='phoneNumber asc' ? 'phoneNumber desc' : 'phoneNumber asc'}" />
  | 						</s:link>
  | 					</f:facet>
  |             #{customer.phoneNumber}
  |         </rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						<s:link styleClass="columnHeader"
  | 							value="?????2 #{customerList.order=='phoneNumber2 asc' ? messages.down : ( customerList.order=='phoneNumber2 desc' ? messages.up : '' )}">
  | 							<f:param name="order"
  | 								value="#{customerList.order=='phoneNumber2 asc' ? 'phoneNumber2 desc' : 'phoneNumber2 asc'}" />
  | 						</s:link>
  | 					</f:facet>
  |             #{customer.phoneNumber2}
  |         </rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">
  | 						<s:link styleClass="columnHeader"
  | 							value="??? #{customerList.order=='fax asc' ? messages.down : ( customerList.order=='fax desc' ? messages.up : '' )}">
  | 							<f:param name="order"
  | 								value="#{customerList.order=='fax asc' ? 'fax desc' : 'fax asc'}" />
  | 						</s:link>
  | 					</f:facet>
  |             #{customer.fax}
  |         </rich:column>
  | 				<rich:column>
  | 					<f:facet name="header">action</f:facet>
  | 					<s:link view="/#{empty from ? 'Customer' : from}.xhtml"
  | 						value="Select" id="customer">
  | 						<f:param name="customerId" value="#{customer.id}" />
  | 					</s:link>
  | 				</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="???? ????" />
  | 			</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">??</ui:define>
  | 					<h:inputText id="name" value="#{customerHome.instance.name}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?? ???</ui:define>
  | 					<h:inputText id="shortName"
  | 						value="#{customerHome.instance.shortName}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?????</ui:define>
  | 					<h:inputText id="address" value="#{customerHome.instance.address}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?????2</ui:define>
  | 					<h:inputText id="address2"
  | 						value="#{customerHome.instance.address2}" />
  | 				</s:decorate>
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">?????</ui:define>
  | 					<h:inputText id="phoneNumber"
  | 						value="#{customerHome.instance.phoneNumber}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">????? 2</ui:define>
  | 					<h:inputText id="phoneNumber2"
  | 						value="#{customerHome.instance.phoneNumber2}" />
  | 				</s:decorate>
  | 
  | 				<s:decorate template="/layout/display.xhtml">
  | 					<ui:define name="label">???</ui:define>
  | 					<h:inputText id="fax" value="#{customerHome.instance.fax}" />
  | 				</s:decorate>
  | 				<a4j:commandButton id="updateCustomerButton"  reRender="customerListTable" action="#{customerHome.update}" ajaxSingle="true" value="????" 
  | 				oncomplete="javascript:Richfaces.hideModalPanel('custForm:panel')" ><s:conversationId/></a4j:commandButton>
  | 				 <h:commandButton onclick="javascript:Richfaces.hideModalPanel('custForm:panel')" value="????"></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.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();
  | 	}
  | 	@Override
  | 	public void setId(Object arg0) {
  | 		// TODO Auto-generated method stub
  | 		super.setId(arg0);
  | 	}
  | 	@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());
  | 	}
  | 	public void selectCustomerFromTable(ActionEvent event){
  | 		setId(new Integer(getId().toString())); 
  | 	}
  | 
  | 	@Override
  | 	public String update() {
  | 		System.out.println("UPDATE");
  | 		return super.update();
  | 	}
  | 	@Override
  | 	public void create() {
  | 		// TODO Auto-generated method stub
  | 		super.create();
  | 	}
  | 
  | }
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4075449#4075449

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4075449



More information about the jboss-user mailing list