1 Reply Latest reply on Jul 11, 2008 7:29 PM by Pete Muir

    Conversations, Wizards, and Home objects

    Greg Zoller Newbie


      I'm trying to do something pretty straightforward.  I want a 2 or 3 screen wizard that will populate and entity object that gets persisted at the end of the wizard.  Sounds like a job for a conversation.

      I start my conversation in a page.xml file:

         <begin-conversation join="true"/>

      I've taken my default seam-gen'ed Home object and added annotations to make it conversation-scoped:

      public class CustorderHome extends EntityHome<Custorder> {
           @In(create = true)
           AddressHome addressHome;
           @In(create = true)
           UserHome userHome;

      Ok, so now the UI.  I have a page like below; the first screen of my wizard:

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      <ui:define name="body">
          <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
          <h:form id="wiz1" styleClass="edit">
              <f:facet name="header">New Order Wizard (1 of 3)</f:facet>
              <s:decorate id="active" template="layout/display.xhtml">
                  <ui:define name="label">Order for User</ui:define>
                     <h:selectOneMenu id="selectUser"
                          <s:selectItems value="#{userList.resultList}" var="user" 
                               noSelectionLabel="Select User"
                               hideNoSelectionLabel="1" />
          <div class="actionButtons">      
              <s:button view="/Wizard_2.xhtml" 
              <s:button view="/home.xhtml"

      So far, so good.  When run I do get a nice pull-down populated with users as I expect, but... when I hit Next to go to wizard page 2 something doesn't carry over--my User assignment from page 1 isn't visible.  In page 1 the pull down is supposed to select and populate a User from the list but on page 2 if I have code like the following I see displayed true, false, (nothing), and (nothing) respectively:

      Managed: #{custorderHome.managed}
      Wired: #{custorderHome.wired}
      Id: #{custorderHome.instance.idcustOrder}
      User: #{custorderHome.instance.user.name}

      What am I not doing right?  I go to the debug.seam screen and can validate that a conversation has been created, a custorderHome object exists in that conversation, but the instance is empty (non-null, but not populated) there too.

      Thanks for any help,