Conversation life-cycle question
bogdanminciu.bogdan.minciu.yahoo.com Mar 22, 2008 9:39 AMHello,
I'm not able to access properties of a conversation scoped component. Here is my component:
@Stateful @Name("blogEntryList") @Scope(ScopeType.CONVERSATION) @Restrict("#{identity.loggedIn}") public class BlogEntryListBean implements LocalBlogEntryList { ... @In(required = false) @Out(required = false) private BlogEntry currentBlogEntry; @DataModel private List<BlogEntry> blogEntries; public BlogEntry getCurrentBlogEntry() { return currentBlogEntry; } public void setCurrentBlogEntry(BlogEntry blogEntry) { log.info("got blogEntry= #0", blogEntry); this.currentBlogEntry = blogEntry; } public List<BlogEntry> getBlogEntries() { return blogEntries; } public void setBlogEntries(List<BlogEntry> blogEntries) { this.blogEntries = blogEntries; } ... }
The setter setCurrentBlogEntry() is called from the blogEntryList.xhtml page:
<h:dataTable id="blogEtriesDataTable" value="#{blogEntries}" var="blogEntry" rendered="#{blogEntryList.resultListSize > 0}"> <h:column> <f:facet name="header">ID</f:facet> #{blogEntry.id} </h:column> <h:column> <f:facet name="header">Title</f:facet> #{blogEntry.title} </h:column> <h:column> <f:facet name="header">Actions</f:facet> <s:link id="blogEntryTest" value="Test" action="#{blogEntryList.setCurrentBlogEntry(blogEntry)}" view="/xcms/blog/blogEntryList.xhtml" />  </h:column> </h:dataTable>
When i click on the link, the setCurrentBlogEntry() method is called, but the output reports null value assigned:
10:19:00,015 INFO [BlogEntryListBean] got blogEntry= null
I guess this has something to do with the life-cycle of the conversation scoped components, but since I am very new to seam and to the notion of conversation, I wasn't able to understand what should I do to keep the component alive
within several page calls.
I even tried to promote my conversation to a long-running one by marking one @Create method of this component with @Begin(join=true), with no success.
On the other hand, if I try to scope the component to SESSION, things are working OK and the blogEntry variable is caught correctly.
Where am I going wrong?
Thank you for any hint.
Bogdan.