6 Replies Latest reply on Dec 26, 2007 12:56 PM by Bradley Smith

    how to 'stay in conversation' with rich suggestionbox?

    Bradley Smith Master

      I am having trouble 'staying in conversation' using a SFSB that backs a parent form and a child form.

      From the parent form, I have the following navigation rule:

       <page view-id="/MMktIssuer.xhtml" login-required="true">
       ...
       <navigation from-action="#{moneyMarketIssuerEditor.insertGuarantor}">
       <begin-conversation join="true"/>
       <render view-id="/EditGuarantorObligor.xhtml"/>
       </navigation>
       ...
       </page>
      


      In the child form, I have a (rich) suggestion box. When I select a value from the suggestions, I have a4j:support tag call a method on my SFSB to update state. I also have a navigation rule:

       <page view-id="/EditGuarantorObligor.xhtml" login-required="true" conversation-required="true">
       <navigation from-action="#{moneyMarketIssuerEditor.selectThirdPartyByCode}">
       <begin-conversation join="true"/>
       <render view-id="/EditGuarantorObligor.xhtml"/>
       </navigation>
       ....
       </page>
      

      Here is the suggestion box JSF markup that triggers the 'selection'

      <a4j:form id="editGuarantorForm">
       <input type="hidden" name="cid" value="#{conversation.id}"/>
       <h:inputHidden id="code" value="#{editGuarantor.thirdParty.code}"/>
      
       <h:panelGrid columns="2">
       <h:outputText value="3rd Party Code"/>
       <h:panelGroup>
       <h:inputText id="thirdPartyCode" value="#{editGuarantor.thirdParty.thirdPartySelectionDisplay}" size="60"
       style="height:20px;background:url('img/magnifying-glass.png') no-repeat center right;vertical-align:middle;"
       maxlength="255"/>
       <h:graphicImage value="img/check2-16x16.png" alt="Ultimate Parent"
       rendered="#{thirdParty.udThirdParty.ultimateParent == 1}"/>
       <h:graphicImage value="img/spacer.png" alt="" width="16" height="16"
       rendered="#{thirdParty.udThirdParty.ultimateParent != 1}"/>
       <rich:suggestionbox for="thirdPartyCode" minChars="1" requestDelay="750"
       suggestionAction="#{thirdPartyHelper.getThirdPartiesByName}"
       var="thirdParty" fetchValue="#{thirdParty.code}"
       height="270" width="285">
       <a4j:support event="onselect" action="#{moneyMarketIssuerEditor.selectThirdPartyByCode}"
       onsubmit="$('editGuarantorForm:code').value=$('editGuarantorForm:thirdPartyCode').value;"
       reRender="editGuarantorForm"/>
       <facet name="nothingLabel"> (case sensitive)
       <h:outputText value="No matches found..."/>
       </facet>
       <h:column>
       #{thirdParty.code} #{thirdParty.name}
       <h:graphicImage value="img/check2-16x16.png"
       rendered="#{thirdParty.udThirdParty.ultimateParent == 1}"/>
       </h:column>
       </rich:suggestionbox>
       </h:panelGroup>
      
       ...
      </a4j:form>
      


      When the a4j:support fires (due to event 'onselect'), the selection should be added to an object that is part of the conversation (parent-child type of relationship). What's happening is that the parent object is now 'reset' as if I started a new conversation.... help?

      Thanks,
      Brad Smith

        • 1. Re: how to 'stay in conversation' with rich suggestionbox?
          Damian Harvey Master

          Do you have you thirdPartyHelper in the Conversation scope (or Session). eg:

          @Name("thirdPartyHelper")
          @Scope(ScopeType.CONVERSATION)


          If so then it could be that your suggestion action is taking too long and the conversation is reset due to the concurrent-request-timeout. If you think that this is the case try increasing the value in your components.xml. Mine is set to 10000 after having some troubles with exactly this issue.

          Cheers,

          Damian.

          • 2. Re: how to 'stay in conversation' with rich suggestionbox?
            Bradley Smith Master

            Damian,

            thirdPartyHelper is a SLSB - the intent here is to simply provide the suggested options - it takes about 2-3 seconds to respond.

            my core:manager settings are as follows:

             <core:manager concurrent-request-timeout="500"
             conversation-timeout="900000"
             conversation-id-parameter="cid"/>
            


            I believe my conversation timeout parameter is longer than your suggestion (15 minutes above). I wonder what that concurrent-request-timeout param does...

            Thanks,
            Brad

            • 3. Re: how to 'stay in conversation' with rich suggestionbox?
              Pete Muir Master

              Brad, see http://docs.jboss.org/seam/2.0.0.GA/reference/en/html/conversations.html#d0e5062 for an in depth discussion of concurrent access to conversational components. To see if this is the problem, try increasing concurrent-request-timeout to about 3000 (6s).

              • 4. Re: how to 'stay in conversation' with rich suggestionbox?
                Bradley Smith Master

                Pete,

                I went to 10 seconds concurrent-request-timeout="10000" - no luck. I looked over the documentation on that in the manual (just above section 6.9.1 which I used to come up with the settings used in the suggestionbox attributes). The basic flow I am trying to 'do' is:

                a.) on an editor page, select or create a new (parent) entity for edit purposes

                b.) add a new child entity to the parent by clicking a link (JSF commandButton which should preserve conversation id - it does).

                c.) return to parent editor page.

                It's while working on b.), during selection of a suggested entity, that I am losing track of the SFSB and other conversational objects (particularly the parent entity) that are bijected on the SFSB using the @In/@Out annotations. Isn't it correct that an entity which is @Out'ed from a SFSB is @Out'ed to the same scope as the SFSB? The default scope for a SFSB should be conversational. Notice above in post one that I put the conversation ID (cid) in the form as extra 'insurance' that my events occur in the scope of the same conversation. Also, I've made sure that my navigation rules 'join' the conversation as well.... (frustration meter rising! ;-))

                Thanks,
                Brad

                • 5. Re: how to 'stay in conversation' with rich suggestionbox?
                  Pete Muir Master

                  Brad, I lost track of this one, sorry about that. Where have you got to with this?

                  • 6. Re: how to 'stay in conversation' with rich suggestionbox?
                    Bradley Smith Master

                    Pete,

                    It's a been a few weeks (~6 ;-)) but I ultimately reverted to session scope for most of our state in the simple application in which the issue arose. Thus, I don't have a solution for the problem I ran into here.

                    I will be in my office mid-next week and can look at that specific application again - we're using suggestionbox quite a bit in it.

                    On another note, I have solved the Seam-with-maven2-and-jboss-embedded-for-testing problem. I've been meaning to post something on a site of my own that provides detailed instructions for how to repeat the solution. Maybe I'll get that out today...

                    Brad