continue a long conversation?
kinghoward Sep 10, 2010 2:09 AMMy application seems unable to continue a conversation. I have a datatable, and commandLinks inside it. Whenever I click one of the links, a method is triggered on the SFSB, but a new conversation is initiated rather than continuing with the long conversation. I tried to use
@Begin(join=true)
on the @Factory method findMessages(), but when another method (select()) is triggered, we have a new conversation.
Can someone please tell me why I have a new conversation? I want the conversation to continue so that I can inject value into @DataModelSelection field messageSelected.
the bean:
@Stateful @Scope(CONVERSATION) @Name("messageManager") public class MessageManagerBean implements Serializable, MessageManager { @DataModel(value="messageList", scope=PAGE) private List<Message> messageList; @DataModelSelection(value = "messageList") @Out(required=false) private Message messageSelected; @Begin(join=true) @Factory("messageList") public List<Message> findMessages() { this.messageList = new ArrayList<Message>(); Message first = new Message("First", "This is a great message", true); this.messageList.add(first); Message second = new Message("Second", "This is an average message", false); this.messageList.add(second); Message third = new Message("Third", "This is a bad message", false); this.messageList.add(third); System.out.println("messageList now has size: " + messageList.size()); return this.messageList; } public void select() { if (messageSelected!=null){ messageSelected.setRead(true); System.out.println("in select(), for message: " + messageSelected.getTitle()); } else{ System.out.println("in select(), NULL message"); } } @End public void endConversation(){ } .... @Remove @Destroy public void destroy() {} }
view xhtml ignoring anything outside the datatable:
<h:dataTable value="#{messageList}" var="msg"> <h:column> <f:facet name="header"> <h:outputText value="Read" /> </f:facet> <h:selectBooleanCheckbox id="read" value="#{msg.read}" disabled="true" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Title" /> </f:facet> <h:commandLink id="link" value="#{msg.title}" action="#{messageManager.select}" /> </h:column> </h:dataTable>