7 Replies Latest reply on Oct 21, 2008 3:37 PM by charlscross

    Understanding conversations

    charlscross

      Hello, I'm a little lost with conversations.
      Let's see my doubts:
      I have a screen with a list of elements and two select items for filter it, and another screen with another list but no select items. The first bean is conversation scoped, and the second is session scoped because I have poller method for refreshing the list.
      I need to keep the state of the select items of the first screen so, If I navigate from the first to the second, keep the select items choice on the list when I'll come back. Should I have to use session bean too instead of conversation??
      Is there any document for understanding seam's conversations with examples other than the seam's reference?

        • 1. Re: Understanding conversations
          nickarls

          Try here

          • 2. Re: Understanding conversations
            charlscross

            Whoooa!!! Thanks!

            • 3. Re: Understanding conversations
              charlscross

              Ok.
              I understand that a conversation is need for keep objects in memory from an user action's starts until this action ends.


              If my aim is to keep the select items choice until the session ends, no matter what other things  the user is doing, will be best to use a session scoped bean??


              Or can I put just the vars that control the selectitems choice to the session context and keep the rest of the bean variables in the conversation context??

              • 4. Re: Understanding conversations
                gjeudy

                Charls Cross wrote on Oct 21, 2008 13:47:


                Ok.
                I understand that a conversation is need for keep objects in memory from an user action's starts until this action ends.

                If my aim is to keep the select items choice until the session ends, no matter what other things  the user is doing, will be best to use a session scoped bean??


                Yes the session scope seems more appropriate in this case. The conversation scope is only good to cache data for the duration of a usecase.



                Or can I put just the vars that control the selectitems choice to the session context and keep the rest of the bean variables in the conversation context??


                You can do that as well. Read more on bijection, the contexts live independent of the bean's declared @Scope. For example you can have a conversation-scoped bean that outjects some variables to session context and other variables to conversation context.


                @Name("myBean")
                @Scope(ScopeType.CONVERSATION)
                public class MyBean {
                
                   @Out(scope=ScopeType.SESSION)
                   private MyType myvar;
                
                   @Out
                   private MyType myvarInheritsScopeFromBean;  // which is conversation scope
                
                   ...
                }
                

                • 5. Re: Understanding conversations
                  charlscross

                  Thanks, you helped me!
                  One last question, annotating a variable with @Out is just the same than writing a getter method, and the same for @In and setter method? Well, it's just what I understood after reading the reference doc, but If I'm in a mistake please help me...

                  • 6. Re: Understanding conversations
                    gjeudy

                    No it is not the same because having getter/setter leaves the variable populated in your bean instance. Comparatively using @In/@Out injects a variable from a context or outjects a variable to a context on every method call to your seam managed bean.


                    Bijection will always disinject the variables at the end of the method call effectively nulling them out.


                    I strongly recommend that you buy a book to get you started with the core concepts of Seam. Seam in Action from Manning is great and is a good complement to the reference documentation.

                    • 7. Re: Understanding conversations
                      charlscross

                      Thanks, just today started with it!! Yes, I think I need to understanding the core concepts better, I'm always getting the things work but with little understanding... It's time to start from beginning..