0 Replies Latest reply on Nov 24, 2010 5:14 AM by Dmitry Volkov

    Starting long running conversation in PostConstruct method and RichFaces.

    Dmitry Volkov Newbie

      i am using weld 1.0.1, Glassfish 3.0.1, RichFaces 4.0.0M4 and have some problems. There is my bean:

      public class PartnerList implements Serializable {
          private PartnerManager pm;
          private Conversation conversation;
          private List<Partner> all;
          private void loadPartnerList() {
              all = pm.loadAll();
          public List<Partner> getAll() {
           return all;

      And view:

      <!-- skipped -->
      <h:form prependId="false">
           <rich:dataScroller id="scr" for="table"/>
           <rich:extendedDataTable value="#{partnerList.all}" frozenColumns="1"
                var="element" id="table" 
                style="height:400px; width:100%;" selectionMode="single" rows="20">
                          <!-- skipped -->
      <!-- skipped -->

      The problem is: the conversation is created each time I do paging with rich:dataScroller.
      I have found the solution here, and added a method to the bean:

       public void listener(ComponentSystemEvent event) {
                 if (conversation.isTransient()) {
                 //this code is newer executed


               <f:event type="preRenderView" listener="#{partnerList.listener}"/>

      to the view.

      conversation.begin() in beforePhase will newer executed, because conversation was already started in loadPartnerList and conversation.isTransient() always returns false, but somehow it helps. Why just conversation.begin() in PostConstruct doesn't work? Is there more elegant way to solve this problem without f:event and beforePhase?