4 Replies Latest reply on Oct 20, 2010 11:47 AM by David D

    Natural conversations: the <conversation> parameter-value attribute

    first last Newbie

      Hello all,


      I have a list of products in productList.xhtml, when the user clicks one of them he is takes to that product's productDetails.xhtml page using a page parameter, and a nested long-running conversation is started.


      I would like that page parameter to act as a natural conversation token, so that if the user opens the same product twice (let's assume once by opening the product's link in a new tab, and once by simply left-clicking the product link) - only a single conversation is started, and the second click resumes it rather than starting a new one.


      I am definitely misunderstanding something about the designers' intentions in respect to the <conversation> tag's 'parameter-value' attribute.


      pages.xml :




      <conversation name="Product"
                 parameter-name="productId"
                 parameter-value="#{productHome.instance.id}"/>
           
      <page view-id="/productDetails.xhtml" conversation="Product">
           <description>
                Product details
           </description>
           
               <begin-conversation join="true" flush-mode="manual"/>
           <param name="productId" value="#{productHome.id}"
                     converterId="javax.faces.Long" />
      </page>



      When is does the EL


      parameter-value="#{productHome.instance.id}"


      evaluate?
      Because I am getting an exception saying the EL produces null, when displaying productList.xhtml:


      SEVERE [viewhandler] Error Rendering View[/productList.xhtml]
      java.lang.IllegalStateException: conversation id evaluated to null: Product



      in the productList.xhtml page I have (under a rich:dataTable with var="_prd") :



      <s:link id="productName"
           value="#{_prd.name}"
           view="/productDetails.xhtml"
           propagation="nest"
           conversationName="Product">
           <f:param name="productId" value="#{_prd.id}"/>
      </s:link>



      Does Seam evaluate parameter-value="#{productHome.instance.id}" when rendering productList.xhtml ???



      My general intention for Seam here is:


      Redirect to the productDetails.xhtml page with the productId parameter set to this row's product id, If this Product entity already has an existing conversation - resume it, don't start a new one.


      What am I doing wrong, how is this done?


      Thanks!