3 Replies Latest reply on May 22, 2009 6:25 PM by Israel Fonseca

    Conversations + Ajax + Single Page

    Israel Fonseca Apprentice
      Is there any good way to make a long-running conversation stays alive while the user is in one page? Ending it whe he leaves? I want this to make a CRUD in one-page without any refresh or redirects.

      I have a seam component scoped to conversation that have a list of objects retrived from the database, and I have the crud operations in it. So with the conversation everthing can be lazy, i can select itens to edit or delete without any problem. (i'm using seam managed persistence context)

      My life would be very easy if i had something like:

      @Scope(ScopeType.CONVERSATIONALPAGE)
      @Name("backingbean")
      public class Backing { ... }

      For while i'm using this strategy in the pages.xml:

           
      <page view-id="/*">
           <action execute="#{conversation.begin}" on-postback="true" />
           <action execute="#{conversation.end}" on-postback="false" />
      </page>

      With this, I clear the conversation when i change a page, and start a new one on the subsequential postbacks(triggered from ajax requests of richfaces).


      But well.. is there any better idea?

      Thks in advance,

      Israel
        • 1. Re: Conversations + Ajax + Single Page
          Nikos Paraskevopoulos Novice

          Hello, have you tried the PAGE scope for this? I am not sure how it behaves regarding persistence contexts, but it seems to fit like a glove the rest of your requirements.

          • 2. Re: Conversations + Ajax + Single Page
            Jeff Newbie

            I encountered the similar problem Israel mentioned. The PAGE Scope doesn't help. The scenario is:
            Iterate over a list of records from database on the same JSF page, user performs some actions (e.g. editing), the result is saved back into the database, then pull some other records out of the same database table. This loop continues until all the records in the table are edited. All these should occur on the same JSF page. How could this be accomplished?
            Any help and/or advice is highly appreciate.

            • 3. Re: Conversations + Ajax + Single Page
              Israel Fonseca Apprentice

              The problem is that the entityManger cant be (or should'nt be) scoped to the PAGE, i think that have problems with serialization (i think), and the PAGE scope is not a very good place to left entityManagers living cause it's only cleaned after another 14 views are requested.


              Anyway, so i really needed something like the ConversationalPage, and looks like i'm not the only one.