2 Replies Latest reply on Oct 31, 2007 11:31 AM by pmuir

    Begin / end conversation on the same view-id/page

    jbuechel

      I need to end a previous conversation and start a new one on the same page.

      For a quick fix i implemented a page (pre.xhtml) with a button in it for beginning the conversation.

      pre.page.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
      
       <end-conversation />
      
       <navigation>
       <rule if-outcome="enter">
       <begin-conversation flush-mode="manual" />
       <redirect view-id="/modules/queryCatalog/catalog/main.xhtml" />
       </rule>
       </navigation>
      
      </page>
      


      pre.xhtml:
      <rich:panel id="queryTreeContainerId" styleClass="fwc-panel-noborder">
       <h:form>
       <h:commandButton value="Enter" action="enter" />
       </h:form>
       </rich:panel>
      


      main.page.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <page xmlns="http://jboss.com/products/seam/pages"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd"
       no-conversation-view-id="/modules/queryCatalog/catalog/pre.xhtml"
       conversation-required="true">
      
      </page>
      


      As in the main.xhtml page has to be displayed a tree with lazy loaded data, the conversation has to be started before the page has been rendered (and not after the user does the first click i.e. expanding a tree node)
      ... i think.

      Can anyone help me with this?


        • 1. Re: Begin / end conversation on the same view-id/page
          jbuechel

          Finally i tried the following in pre.page.xhtml (replaced the button with action execute, which calls an empty action method):

          <?xml version="1.0" encoding="UTF-8"?>
          <page xmlns="http://jboss.com/products/seam/pages"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
          
           <end-conversation />
          
           <action execute="#{navigatior.openQueryCatalog}" />
          
           <navigation from-action="#{navigatior.openQueryCatalog}">
           <begin-conversation flush-mode="manual" />
           <redirect view-id="/modules/queryCatalog/catalog/main.xhtml" />
           </navigation>
          
          </page>
          


          It seems to work..

          Is this the way to do it or does anyone know a better solution?


          • 2. Re: Begin / end conversation on the same view-id/page
            pmuir

            You can't end and start a *new* long running conversation in the same request without using before-redirect. And Seam really isn't designed to be used with this model. Better to design your app not to need this.