2 Replies Latest reply on Aug 31, 2008 11:59 AM by Pete Muir

    richfaces and conversation propagation issues

    Guillaume Jeudy Master

      Hi,


      I'm rerendering portions of a page using AJAX requests and if I click on my single selection list repeatdly I sometimes get a:

      The conversation ended, timed out or was processing another request

      . I use an eventQueue on the client-side. I'm certain the conversation does not time-out because I clicked several times in quick succession queuing several ajax requests in a short period of time.


      I get to the page using:


      <s:button action="#{classificationUseAction.findOrgUnitsByProduct}"
                          value="${actionLabel} Classification Use" >
                          <f:param name="returnPage" value="/editProduct.xhtml"/>
      </s:button>



      pages.xml


      <page view-id="/editProduct.xhtml" conversation-required="true" no-conversation-view-id="/showpackages.xhtml">
                <navigation from-action="#{classificationUseAction.findOrgUnitsByProduct}">
                     <redirect view-id="/editClassificationUse.xhtml" />
                </navigation>
      </page>



      editClassificationUse.xhtml:


                <a4j:outputPanel id="coveragesPanel">
                     <a4j:region id="coveragesRegion">
                          <a4j:form id="coveragesForm" rendered="#{not empty coverages}">
                               <s:span styleClass="label">Coverages (from selected product)</s:span>
                               <s:div id="rel">
                                    <h:selectOneListbox id="coverages" required="true"
                                         value="#{selectedCoverage}" size="10">
                                         <s:selectItems value="#{coverages}" var="coverage"
                                              label="#{coverage.specificationNm} -- #{coverage.specificationCd}" />
                                         <s:convertEntity />
                                         <a4j:support action="#{classificationUseAction.selectCoverage}"
                                              reRender="existingClassificationUsesPanel" event="onclick" eventsQueue="classifUseQueue" ignoreDupResponses="true" />
                                    </h:selectOneListbox>
                               </s:div>
                               <a4j:status>
                                    <f:facet name="start">
                                         <h:graphicImage value="/img/spinner.gif" />
                                    </f:facet>
                               </a4j:status>
                          </a4j:form>
                     </a4j:region>
                </a4j:outputPanel>
                <a4j:outputPanel id="existingClassificationUsesPanel">
                     <a4j:form id="existingClassificationUseForm"
                          rendered="#{(not empty unrelatedClassificationUses) or (not empty relatedClassificationUses)}">
                          <rich:listShuttle targetValue="#{relatedClassificationUses}"
                               sourceValue="#{unrelatedClassificationUses}"
                               targetCaptionLabel="Related Classification Uses"
                               sourceCaptionLabel="Unrelated Classification Uses"
                               fastOrderControlsVisible="false" orderControlsVisible="false"
                               moveControlsVisible="${editMode}" fastMoveControlsVisible="${editMode}"
                               listsHeight="400px" sourceListWidth="400px" targetListWidth="400px"
                               copyAllControlLabel="Relate All" copyControlLabel="Relate"
                               removeAllControlLabel="Unrelate All" removeControlLabel="Unrelate"
                               converter="#{com.archinsurance.web.converter.IdentifiableConverter}"
                               var="classificationUseVO">
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Class Code" />
                                    </f:facet>
                                    <h:outputText
                                         value="#{classificationUseVO.classificationSpecISO.code}" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Class Name" />
                                    </f:facet>
                                    <h:outputText
                                         value="#{classificationUseVO.classificationSpecISO.classificationDesc}" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Cov Group Name" />
                                    </f:facet>
                                    <h:outputText
                                         value="#{classificationUseVO.classificationSpecISO.coverageGroup.description}" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Valid From Dt" />
                                    </f:facet>
                                    <rdm:smartDate id="validFromDt"
                                         value="#{classificationUseVO.validityPeriod.validFromDate}"  ajaxValidate="false" />
                               </h:column>
                               <h:column>
                                    <f:facet name="header">
                                         <h:outputText value="Valid To Dt" />
                                    </f:facet>
                                    <rdm:smartDate id="validToDt"
                                         value="#{classificationUseVO.validityPeriod.validToDate}"  ajaxValidate="false" />
                               </h:column>
                          </rich:listShuttle>
                          <h:commandButton action="#{classificationUseAction.save}"
                               rendered="${editMode}" value="Save" />
                     </a4j:form>
                </a4j:outputPanel>
      



      Backing bean:


      @Stateful(mappedName="ClassificationUseAction")
      @Scope(ScopeType.CONVERSATION)
      @Name("classificationUseAction")
      @Restrict("#{identity.loggedIn}")
      @Local(value=ClassificationUseAction.class)
      public class ClassificationUseActionBean implements ClassificationUseAction {
      
               @Create
           public void init() {
                log.info("classificationuse bean created, conversation id: #0", Manager.instance().getCurrentConversationId());
           }
      
               @Begin(nested=true)
           public void findOrgUnitsByProduct() {
                // snip snip
           }
      
               public void selectCoverage() {
                   // snip snip
               }
      }
      



      In my test I call the following:


      <a4j:support action="#{classificationUseAction.selectCoverage}"
                                              reRender="existingClassificationUsesPanel" event="onclick" eventsQueue="classifUseQueue" ignoreDupResponses="true" />
      



      repeatedly and sometimes it would instantiate a 2nd backing bean and fail with the error: The conversation ended, timed out or was processing another request.  Other times there would be no errors and no data returned from the server at all.


      I'm using Seam 2.0.1 with Richfaces 3.2.1 and JSF RI 1.2. I'm using JSF STATE SAVING METHOD - server.


      Please advise what is best practice in this case
      -Guillaume