[jboss-user] [JBoss Seam] - Re: Bijection clarification

smithbstl do-not-reply at jboss.com
Tue Jul 24 16:06:39 EDT 2007


Ok, I am still having problems with Address getting injected into my second sfsb

Here is what is going on

A form is submitted to sfsb "addressLocator" via an actionListener on the a4j:commandButton

<h:form id="addressSearch_Form">
  | 	<h:panelGrid columns="2">
  | 		//Form inputs here bound to address fields				
  | 	</h:panelGrid>
  | 	<a4j:commandButton actionListener="#{addressLocator.findAddressByAddress}" 
  | 		value="#{messages['AddressLookup.search']}"
  | 		reRender="searchResults"/>
  | 		
  | ...searchResults here....
  | 
  | 	<h:panelGrid columns="1" rendered="#{address != null}">
  | 		<h:outputText value="Address Not Found?"/>
  | 		<h:commandLink value="Create a Service Request with the address you entered above" action="createRequestFromAddress"/>	
  | 	</h:panelGrid>
  | </form>	

Here is the my first sfsb "AddressLocator"
@Stateful
  | @Name("addressLocator")
  | @Scope(ScopeType.CONVERSATION)
  | @SuppressWarnings("unchecked")
  | public class AddressLocatorAction implements AddressLocator {
  |  
  |     @In
  |     private EntityManager entityManager;  
  |     
  |     @In(required=false)
  |     @Out(scope=ScopeType.CONVERSATION, required=false)
  |     private Address address;  
  | 
  | 
  |     public AddressLocatorAction() {
  |     }
  | 
  |     public void findAddressByAddress(ActionEvent event) {
  |   	//Uses address for query, address has value here
  |     }

after a dataTable "searchResults" is reRendered, the commandLink is pressed which calls requestManager.createRequestFromAddress()

@Stateful
  | @Name("requestManager")
  | @Scope(ScopeType.CONVERSATION)
  | public class RequestManagerAction implements com.stlouiscity.csb.ejb.action.RequestManager {
  |     
  |     @In
  |     private EntityManager entityManager; 
  |     
  |     @In
  |     private Address address;
  | 
  | 
  |     public RequestManagerAction() {
  |     }
  |     
  |     public void createRequestFromAddress() {
  |     	serviceRequest = new ServiceRequest();
  | 
  |         //This is a different address instance than was outjected 
  |         //   by addressLocatorAction, fields are null
  |     	serviceRequest.setAddress(address);
  |     }

The address component that is outjected from addressLocator is not the same instance that is injected into requestManager.  I can see the orginal address component on the seam debug page but a different instance belongs to serviceRequest on the debug page.  This is taking place in the scope of a long running conversation being managed by a jpdl pageflow.

Thanks again.

Thanks again.

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

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



More information about the jboss-user mailing list