[jboss-user] [JBoss Seam] - Re: #{conversationList} appears to be empty

jacob.orshalick do-not-reply at jboss.com
Fri Sep 28 13:57:17 EDT 2007


"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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089807#4089807

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089807



More information about the jboss-user mailing list