1 Reply Latest reply on May 29, 2008 3:13 PM by Chris Simons

    Newbie question, please clarify: Conversation Propagation with ajax?

    David Knaus Newbie

      Hello,


      after reading Seam / Richfaces docs and Seam in Action MEAP, I learned a thing about conversations, but I'm still a bit puzzled.


      Please clarify if I'm right with the following:


      With a richfaces components like



      <rich:comboBox selectFirstOnUpdate="false"
              defaultLabel="Enter some value">
              <f:selectItems value="#{myConvComp.options}" />
      </rich:comboBox>



      I can't put @Begin on getOptions() getter at the conversation scoped myConvComp component to start a new conversation on every select change, because only method level @Begin or @End annototaions are allowed, right?


      But what about <a4j:commandLink>? Conversation change (Ending current, starting nested etc.) is happening in JSF Redirect to new page (or even same page), according to this forum topic.


      But I don't want to do a full page refresh, just a partial ajax update. Is there a way to start and end nested conversations without full refresh? What about conversationPropagation parameter including in <a4j:commandLink>? When there is no redirect it would be useless, or not?


      Use case would be like that: build up complex search form and start /end nested conversations for last 2 search options.


      Is this possibly with plain Richfaces or do I need to use <s:link> with redirects in pages.xml and full page refresh?


      Any comments, suggestions or examples about similar usage are appreciated, thanks.


      Regen


        • 1. Re: Newbie question, please clarify: Conversation Propagation with ajax?
          Chris Simons Expert

          Good question - you do not want/need any conversation scoping on your bean for rendering the select item options.  The conversation deals with page transitions - not loading data from a bean.


          What you're looking for should be really simple. 


          Within your <rich:comboBox> you want to use an <a4j:support> that reRenders some component(s) on the 'onChange' event.


          Here is an example when using an h:selectOneListBox:



          <h:selectOneListbox partialSubmit="true" id="documentType" required="true"
                                                                          size="1" value="#{cvIdent.documentType}">
          <a4j:support event="onchange" ajaxSingle="true" reRender="createIdentForm"/>              
                                                                  <s:selectItems var="value" label="#{value.name}"
                                                                          value="#{valueManager.values['Document Type']}" 
                                                                          noSelectionLabel="-- Click to View Options --"/>
                                                                  <s:convertEntity />
                                                          </h:selectOneListbox>