6 Replies Latest reply on Nov 5, 2007 10:30 AM by Grégory Tanneau

    Another conversation question ...

    Grégory Tanneau Newbie

      Hi all !

      I have a screen displaying a list of devices. A device can be edited (from a button in the datatable)
      When a submit a find on my deviceList screen, I start a new conversation.
      When I edit a device, a create a nested conversation : once on my edit screen, I want to be able to go back to my previous search (aka the parent conversation).

      The problem :
      When a perform a save, on my edit screen, everything seems ok (faces message ok, entity updated). But then, when I click on my cancel/back button, to go back to my list, it is empty ... I mean, everything is still in the conversation (my search panel, even the rowCount of the list) but the list contains null elements ...

      Here is part of my code :

      pages.xml

      ...
       <page view-id="/parc_deviceList.xhtml" no-conversation-view-id="/parc_deviceList.xhtml">
       <description>Device Search (Results: #{deviceSearch.rowCount})</description>
       </page>
      ...
       <page view-id="/parc_deviceEdit.xhtml">
       <description>Edit Device</description>
       <param name="deviceId" value="#{deviceHome.deviceId}"/>
       <action execute="#{deviceHome.init}"/>
       <begin-conversation flush-mode="MANUAL" join="true"/>
       <navigation>
       <rule if-outcome="updated">
       <redirect view-id="/parc_deviceEdit.xhtml">
       </redirect>
       </rule>
       </navigation>
       </page>
      ...
      


      parc_deviceList.xhtml
      ...
       <h:commandLink id="find" styleClass="button"
       action="#{deviceSearch.find()}"
       tabindex="6">
       <s:conversationPropagation type="join" />
       <h:outputText styleClass="buttonLabel" value="#{messages['findButton']}"/>
       </h:commandLink>
      ...
       <h:dataTable id="deviceTable" var="d"
       value="#{devicesList}"
      ...
       <h:column>
       <f:facet name="header"> </f:facet>
      
       <s:link view="/parc_deviceEdit.xhtml" propagation="nest" title="#{messages['device.edit']}">
       <h:graphicImage value="/img/bt_mini_edit.gif" style="border:0; padding:2px;" />
       <f:param name="deviceId" value="#{d.id}"/>
       </s:link>
       </h:column>
      ...
      


      parc_deviceEdit.xhtml
       <h:form id="deviceEditForm">
       <div class="formFields wideLabels formBorder">
       <s:validateAll>
      ...
       </s:validateAll>
       </div>
      
       <div class="formControls wideLabels">
       <div class="entry">
       <div class="label"> </div>
       <div class="input">
       <h:commandLink id="update" styleClass="button"
       action="#{deviceHome.update}"
       tabindex="9">
       <span class="buttonLabel">#{messages['saveButton']}</span>
       </h:commandLink>
      
       <s:link id="cancel" styleClass="button" view="/parc_deviceList.xhtml"
       tabindex="9">
       <span class="buttonLabel">#{messages['cancelButton']}</span>
       </s:link>
       </div>
       </div>
       </div>
      
      


      DeviceHome.java
      @Name("deviceHome")
      @Scope(ScopeType.CONVERSATION)
      public class DeviceHome extends EntityHome<RTHDevice> {
      
       @Logger
       private Log logger;
      
      
       public Long getDeviceId() {
       return (Long)getId();
       }
      
       public void setDeviceId(Long deviceId) {
       setId(deviceId);
       }
      
       public void init() {
       logger.debug("DeviceHome.init()");
      
       if (isManaged()) {
       } else {
       }
       }
      
       public String persist() {
       logger.debug("DeviceHome.persist()");
       getInstance().setActive(0);
      
       return super.persist();
       }
      
       public String update() {
       logger.debug("DeviceHome.update()");
       return super.update();
       }
      }
      


      DeviceSearchAction.java
      @Stateful
      @Scope(ScopeType.CONVERSATION)
      @Name("deviceSearch")
      @Restrict("#{identity.loggedIn}")
      public class DeviceSearchAction implements DeviceSearch, Serializable {
      ...
       @DataModel
       List<RTHDevice> devicesList;
      ...
      


      I can't figure out why this happens.
      Could you help me a few ?

      I'm currently using seam 2.0.0.CR1 on JBoss 4.2.1.GA.

      Thanks for your help !