1 2 Previous Next 25 Replies Latest reply on Oct 11, 2007 5:45 PM by b.reeve

    #{conversationList} appears to be empty

      I'm trying to display the above:

      <rich:panel rendered="true">
      <ui:repeat value="#{conversationList}" var="conv">
      <h:column><h:outputText value="#{conv.description}"></h:outputText>
      </h:column>
      </ui:repeat>

      in a variant of the above. I've annotated the relevant methods with @Begin and @End and have added descriptions for pages in pages.xml

      But nothing displays.
      What am I missing?

        • 1. Re: #{conversationList} appears to be empty

          Have you looked at debug.seam to see what ConversationEntries should be in the conversationList? This will tell you if the long-running conversation has started or not.

          • 2. Re: #{conversationList} appears to be empty

            Thanks, looking at the debug page shows that there are no long running conversations, although I have seen them present during exceptions. That therefore explains why none appear! However, ...

            As a temporary hack I added a coupled of buttons to attempt to start and end a conversation, connected to methods annotated with @Begin and @End - under the apparently misguided notion that invoking these methods would explicitly control the conversation and hey presto something would appear.

            However, I don't appear to understand conversations, any ideas?

            • 3. Re: #{conversationList} appears to be empty

              By invoking an action annotated with @Begin, you will promote a conversation to long-running. This should cause a ConversationEntry to show up in your conversationList. Add a print statement in the @Begin to make sure your method is actually being invoked.

              Also, here is a quick way to see when conversations are being started and ended:

              @Name("conversationLogger")
              public class ConversationLogger implements Serializable {
               @Logger
               private Log log;
              
               @Observer("org.jboss.seam.beginConversation")
               public void logConversationBegin()
               {
               Conversation currentConversation = Conversation.instance();
              
               log.info("Beginning conversation: #0, Parent Id: #1",
               currentConversation.getId(), currentConversation.getParentId());
               }
              
               @Observer("org.jboss.seam.endConversation")
               public void logConversationEnd()
               {
               Conversation currentConversation = Conversation.instance();
              
               log.info("Ending conversation: #0, Parent Id: #1",
               currentConversation.getId(), currentConversation.getParentId());
               }
              }


              I find this very helpful, especially when using nested conversations.

              • 4. Re: #{conversationList} appears to be empty

                Many thanks for your suggestions. In the light of this I've modified the XHTML to:
                <rich:panel rendered="true">
                <s:link value="Begin conversation"
                action="#{personAction.beginConversation}" />
                &#160;
                <s:link value="End conversation"
                action="#{personAction.endConversation}" />
                <f:facet name="header">Conversations</f:facet>
                <f:subview id="conversations">
                <ui:repeat value="#{conversationList}" var="conv">
                ID: <h:outputText value="#{conv.id}"></h:outputText>
                Descr: <h:outputText value="#{conv.description}"></h:outputText>
                </ui:repeat>
                </f:subview>
                </rich:panel>

                and the 'begin conversation' method to the following abomination:
                @Begin(join=true)
                public String beginConversation() {
                Conversation c = Conversation.instance();
                boolean started = c.begin();
                log.info("### begun a new conversation: " + started);

                ConversationEntries entries = ConversationEntries.instance();
                log.info("### Have " + entries.size() + " conversations");
                Collection cce = entries.getConversationEntries();
                Iterator it = cce.iterator();
                while (it.hasNext()) {
                ConversationEntry ce = (ConversationEntry)it.next();
                log.info("### Conversation id: " + ce.getId() + ", descr: " + ce.getDescription());
                }

                return null;
                }

                The log file now has entries such as:
                17:09:31,788 INFO [PersonActionImpl] ### Beginning conversation
                17:09:31,788 INFO [PersonActionImpl] ### begun a new conversation: false
                17:09:31,788 INFO [PersonActionImpl] ### Have 2 conversations
                17:09:31,788 INFO [PersonActionImpl] ### Conversation id: 5, descr: null
                17:09:31,788 INFO [PersonActionImpl] ### Conversation id: 9, descr: null

                Originally I was only displaying the description - seeing that this is null I thought that might explain the absence of output (even though I have given my pages a description in pages.xml), however as you can see the id is not null but still no output!

                • 5. Re: #{conversationList} appears to be empty

                  Interesting. The ConversationEntries are obviously being populated. The conversationList is simply a manager component that calls the same method you are calling to retrieve the ConversationEntries, orders them, and provides them as a List.

                  Try using #{org.jboss.seam.core.conversationList}. I wonder if the alias is having an issue. You could also try injecting the conversationList into your action @In(value="org.jboss.seam.core.conversationList") to print out what it contains in the log.

                  • 6. Re: #{conversationList} appears to be empty

                    Interesting is one word for this; I can think of others!

                    Thanks for your suggestions: using the @In(value= generates an exception: javax.ejb.EJBTransactionRolledbackException: could not set field value: personAction.org.jboss.seam.core.conversationList; using #{org.jboss.seam.core.conversationList} makes no difference.

                    #{!empty(conversationList)} when called within a JSF page appears to be false (ie the list is empty) but code in my action handler indicates the opposite and the debug page shows a new conversation each time I open up a new instance of the application in a new tab.

                    This behaviour does not make a lot of sense to me - Seam seems to either work really nicely or leave you scratching your head. I'm clutching at straws now. Is there any arcane configuration I need to do or annotations I need to add other than @Begin, @End? I'm running Seam 2.0.0CR1 on JBoss 4.2.0.GA.

                    • 7. Re: #{conversationList} appears to be empty
                      trickyvail

                      In order for the conversationList to display your conversations they must have descriptions set in pages.xml.

                      Please refer to this post: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049848#4049848

                      • 8. Re: #{conversationList} appears to be empty

                        Thanks - you beat me to it - I was just about to reply to Jacob to say that, although I thought I had put a description in pages.xml, on closer inspection (!) I realized I hadn't - when I did put them in I get to see the conversations. In my defence, this seems to be very fragile behaviour but apologies for the red herring and many thanks to yourself and Jacob for your help.

                        • 9. Re: #{conversationList} appears to be empty

                          Not a problem, glad it worked out. I would say that this probably indicates that the documentation could be improved based on your issue and the link that trickyvail provided. The documentation simply states the following:

                          org.jboss.seam.core.conversationList

                          Manager component for the conversation list.


                          The examples show how it works, but I would recommend raising a JIRA issue to improve the documentation of this.

                          • 10. Re: #{conversationList} appears to be empty
                            trickyvail

                            I agree that a short sentence describing this requirement added to the documentation at 6.7.3 would be helpful to people using the conversationList or switcher.

                            You may also be able to set the conversation description programatically. Something like this I think:

                            ((Conversation) Component.getInstance(org.jboss.seam.core.Conversation)).setDescription(String)

                            Not totally sure if this will work as expected.

                            I agree that this behavior is fragile. Perhaps if you create a JIRA you could also ask if in the event the description is not set, the conversationList and switcher fall back to some other description string created from the id or similar.

                            • 11. Re: #{conversationList} appears to be empty

                              Actually, there appears to be a little twist - it only works if I leave this kludge in the @Begin annotated method:

                              Conversation c = Conversation.instance().begin();

                              I put this in while stumbling around in the dark.

                              The @End method seems to work fine but @Begin doesn't actually seem to begin a conversation.

                              • 12. Re: #{conversationList} appears to be empty

                                 

                                "djfjboss" wrote:
                                Actually, there appears to be a little twist - it only works if I leave this kludge in the @Begin annotated method:

                                Conversation c = Conversation.instance().begin();

                                I put this in while stumbling around in the dark.

                                The @End method seems to work fine but @Begin doesn't actually seem to begin a conversation.


                                I ran into this same issue awhile back. This appears to be a bug. If you go to another page and come back, or do a GET request on the page, you will see the conversationList populated with your entry. Unless I started the conversation the first time the page was accessed, I would run into this (i.e. a method executes with @Begin and returns you to the page).

                                It appears that the problem is the current implementation of conversationList is a factory method scoped to the PAGE. A patch that works for me is to make the ConversationList a manager component rather than a factory method. The patch is:

                                @Scope(ScopeType.STATELESS)
                                @Name("org.jboss.seam.core.conversationList")
                                @AutoCreate
                                @Install(precedence=BUILT_IN)
                                @BypassInterceptors
                                public class ConversationList
                                {
                                
                                 protected List<ConversationEntry> createConversationEntryList()
                                 {
                                 ConversationEntries conversationEntries = ConversationEntries.instance();
                                
                                 if (conversationEntries==null)
                                 {
                                 System.out.println("ConversationEntries is null!");
                                
                                 return Collections.EMPTY_LIST;
                                 }
                                 else
                                 {
                                 System.out.println("ConversationEntries is not null... there are "
                                 + conversationEntries.getConversationEntries().size() + " entries");
                                
                                 Set<ConversationEntry> orderedEntries = new TreeSet<ConversationEntry>();
                                 orderedEntries.addAll( conversationEntries.getConversationEntries() );
                                 List<ConversationEntry> conversationEntryList =
                                 new ArrayList<ConversationEntry>( conversationEntries.size() );
                                 for ( ConversationEntry entry: orderedEntries )
                                 {
                                 if ( entry.isDisplayable() && !Session.instance().isInvalid() )
                                 {
                                 conversationEntryList.add(entry);
                                 }
                                 }
                                 return conversationEntryList;
                                 }
                                 }
                                
                                 @Unwrap
                                 public List<ConversationEntry> getConversationEntryList()
                                 {
                                 return createConversationEntryList();
                                 }
                                }


                                I will submit a JIRA issue for this.

                                • 13. Re: #{conversationList} appears to be empty
                                  b.reeve

                                  I am facing a similar problem. I can see the conversationEntries displayed properly with the descriptions, when i print them in the console.

                                  But, I am getting an UnsupportedOperationException when I include #{conversationList} or #{org.jboss.seam.core.conversationList} in my page.

                                  Could anyone please help me.

                                  • 14. Re: #{conversationList} appears to be empty

                                    JIRA issue created for conversationList issue:

                                    http://jira.jboss.org/jira/browse/JBSEAM-1997

                                    1 2 Previous Next