1 2 Previous Next 15 Replies Latest reply on Mar 7, 2007 3:59 AM by h.cahyadi

    Multiple Window/Tabs isolated conversations

    h.cahyadi

      Hi all,

      How to get Multiple Window/Tabs isolated conversations, do we must make our "controller" as a SFSB? can anyone here give me example or explanation how to achieve Multiple Window/Tabs isolated conversations? Can this be applied to portlet environment?

      Thanx and regards,

      -haric-

        • 1. Re: Multiple Window/Tabs isolated conversations
          pmuir

          Conversations are "isolated" (they aren't propogated, but you could jump to another one using the conversation switcher) between browser tabs/windows by default.

          • 2. Re: Multiple Window/Tabs isolated conversations
            h.cahyadi

            OK let me give a more complete description

            Environment :
            - Seam 1.1.1 GA
            - Jboss Portal 2.4 GA
            - MyFaces 1.1.4
            - OS Win XP

            I have an application that manage internal document, and if the number of documents is very large, I perform data paging, so I only display 10 documents per page, the problem is when I login as the same user for two windows/tabs (window A and Window B) and I perform the paging,

            in window A :
            initial status :
            displaying 10 documents of 100, page 1 of 10

            in window B :
            initial status :
            displaying 10 documents of 100, page 1 of 10

            When I perform first action at window A with pressing next button(I do "go to the next page") the status will be like this :
            Window A :
            displaying 10 documents of 100, page 2 of 10

            Until last step above, everything is going well, but when I do an action in window B with pressing the next button the status starts to be strange like this :
            Window B :
            displaying 10 documents of 100, page 3 of 10

            I expect that the status in window A are isolated from window B and vice versa, so when I perform an action in window B, the status that I expect is like this :
            Window B :
            displaying 10 documents of 100, page 2 of 10

            not jump to third place, I guessed thats because of there are shared state between the two pages, not isolated state. and this is part of my code :

            @Name("controller")
            @Scope(SESSION)
            @Synchronized
            public class myController implements Serializable {
            
             /** Start index */
             @Out(scope = CONVERSATION, required = false)
             private int startIndex;
            
             /** Page number */
             @Out(scope = CONVERSATION, required = false)
             private int page;
            
             /** Number Of all records */
             @Out(scope = CONVERSATION, required = false)
             private int totalNumberOfResults;
            
             /** Total number of pages */
             @Out(scope = CONVERSATION, required = false)
             private int totalNumberOfPages;
            
             /** End index */
             @Out(scope = CONVERSATION, required = false)
             private int endIndex;
            
            .......
            
             public void pagingNext() {
             totalNumberOfResults = getTotalNumberOfRestults();
             totalNumberOfPages = (totalNumberOfResults % pageSize == 0 ? totalNumberOfResults
             / pageSize
             : (totalNumberOfResults / pageSize) + 1);
            
             page++;
             if (page > totalNumberOfPages - 1) {
             page = totalNumberOfPages - 1;
             }
            
             startIndex = page * pageSize;
             endIndex = (page == totalNumberOfPages - 1 ? totalNumberOfResults : startIndex + pageSize);
            
             }
            
            ......
            
            
            }
            



            I hope this description is clear, and I hope somebody outhere can help me

            Thanx and Regards,
            -haric-


            • 3. Re: Multiple Window/Tabs isolated conversations
              pmuir

              Surely the controller should be conversation scoped not session scoped for the behavior you want?

              Why not just use the paging built into Query objects?

              • 4. Re: Multiple Window/Tabs isolated conversations
                h.cahyadi

                Are you sure that we must put the scope into "conversation"? bacause in the booking demo I saw the the scope is SESSION and it can perform multiple windows transaction


                Why not just use the paging built into Query objects?


                what do you mean by that, could you explain me?

                Thanx
                -haric-

                • 5. Re: Multiple Window/Tabs isolated conversations
                  pmuir

                   

                  "h.cahyadi" wrote:
                  Are you sure that we must put the scope into "conversation"? bacause in the booking demo I saw the the scope is SESSION and it can perform multiple windows transaction


                  Thtats the way I would do it.


                  Why not just use the paging built into Query objects?


                  what do you mean by that, could you explain me?


                  The Seam Application Framework. (btw upgrade to a newer version)

                  • 6. Re: Multiple Window/Tabs isolated conversations
                    h.cahyadi

                    Thanx petemuir for your sugestion, but until now this problem not yet solved in my application, any other suggestion?

                    Thanx and Regards,
                    -haric-

                    • 7. Re: Multiple Window/Tabs isolated conversations

                       

                      "h.cahyadi" wrote:
                      Are you sure that we must put the scope into "conversation"? bacause in the booking demo I saw the the scope is SESSION and it can perform multiple windows transaction


                      Why not just use the paging built into Query objects?


                      what do you mean by that, could you explain me?

                      Thanx
                      -haric-


                      I think I may be understand what's the confusion here. In the examples the result lists are stored in session (on my opinion) for simplicity (or demo) purposes.
                      I have not actually tried to keep result lists isolated (in conversation scope) but my guess would be is that you can a long-running conversation upon first search request (and then perform @Begin(join=true) for each pagination) but this all would work only provided that you have started search queries in separate windows/tabs (otherwise you may get situation similar to the current one).

                      • 8. Re: Multiple Window/Tabs isolated conversations

                        Another solution would be to use request scope and pass search parameters in url.

                        In any case it may cost you more performance due to bigger number of DB trips in comparison to session scope.

                        • 9. Re: Multiple Window/Tabs isolated conversations
                          h.cahyadi

                          petemuir wrote:

                          The Seam Application Framework. (btw upgrade to a newer version)


                          I have upgrade to seam 1.1.5 GA and also read the documentation about the The Seam Application Framework, but if we use that method to do paging, is there any method to display the status of paging like :
                          total number of data, total number of pages, current page number, etc. ?

                          For svadu, sorry for now I am not yet try your sugestion, I will try it and post the result here, but until now I am not yet fixing this problem :(

                          • 10. Re: Multiple Window/Tabs isolated conversations
                            ccurban

                            I think you are simply missing some @In tags here.

                            Actually you are just outjecting the page data to the conversation, but you don't use them for calculating the values for the next page. Therefore you use the data in the session-scoped SFSB for calculation.

                            • 11. Re: Multiple Window/Tabs isolated conversations
                              h.cahyadi

                              ccurban, I have tried to add @In annotations, but when I test it using multiple tabs in firefox I still getting that the stated is not isolated between the tabs, but in internet explorer I try to open two windows and that works fine, I don't sometimes I get stressed with this browser different behaviour, I also facing problem with back button in IE, but here I am geting trouble with firefox :(

                              Thanx and Regards,
                              -haric-

                              • 12. Re: Multiple Window/Tabs isolated conversations
                                gavin.king

                                 

                                I have upgrade to seam 1.1.5 GA


                                1.2 is out.


                                and also read the documentation about the The Seam Application Framework, but if we use that method to do paging, is there any method to display the status of paging like :
                                total number of data, total number of pages, current page number, etc. ?


                                Yes of course. Check all the methods on Query/EntityQuery. You can extend with whatever extra methods you need.

                                • 13. Re: Multiple Window/Tabs isolated conversations
                                  h.cahyadi

                                  In the version 1.2 is there any changes with the .xml file descriptor, coz I look at the JIRA and found some changes, to the descriptor file, if in my application architecture I separate the business logic and the presistence logic, can I still used the entity query, currently I stuck with 2 problems :

                                  1. Back button problem ( http://www.jboss.com/index.html?module=bb&op=viewtopic&t=102681 )
                                  the back button works on firefox and opera but not in Internet Explorer

                                  2. Multiple windows isolated conversations
                                  multiple windows isolated conversations work on Internet explorer, but not works in both firefox and opera

                                  I still investigating about this two problems, but currently I am ran out of idea, because there are many component that I combine, I used combination of MyFaces 1.1.5, Facelets 1.1.11, Seam 1.1.5 GA, Jboss Portal 2.4GA and Jboss AS 4.0.5 GA, is there any known issues between this combination? please give me some "light"

                                  Thanx and Regards,
                                  -haric-

                                  • 14. Re: Multiple Window/Tabs isolated conversations
                                    kukeltje

                                    multiple windows works perfectly here in FF. If you only see the correct behaviour in IE and you open windows not via ctrl-n but e.g .via the start menu, then you get a completely new session. That way it has always worked in IE to have multiple session. So my conclusion is that there is something wrong with the way you start new conversations

                                    1 2 Previous Next