-
1. Re: Conversations doing my head in - help
nickarls Jan 18, 2008 3:37 PM (in response to mail.micke)Tried your code in a JBoss Tools project? It is really straightforward and assures that you don't struggle with some library conflict somewhere.
-
2. Re: Conversations doing my head in - help
samdoyle Jan 18, 2008 6:36 PM (in response to mail.micke)JBoss Tools is nice. I wish there was integration with NetBeans in addition to Eclipse.
-
3. Re: Conversations doing my head in - help
mail.micke Jan 20, 2008 10:26 AM (in response to mail.micke)hi all
Can someone see an error in the way I try and kick-off a long running conversation? -
4. Re: Conversations doing my head in - help
jacob.orshalick Jan 20, 2008 1:38 PM (in response to mail.micke)"mail.micke@gmail.com" wrote:
The last two buttons, executes the action but the conversation Id is incremented.
This is because each request initializes a temporary conversation if a long-running conversation is not resumed. This means that your first page request resulted in a temporary conversation with a specific cid. The next request also results in a temporary conversation with an incremented cid, then that temporary conversation is promoted to long-running. The long-running conversation gets the cid for the temporary conversation that was promoted.
Hope that helps. -
5. Re: Conversations doing my head in - help
mail.micke Jan 20, 2008 2:02 PM (in response to mail.micke)Hi Jacob
Not quite sure I understood.
For the last two buttons the cid is always incremented, which I thought meant that the temporary conversation was never promoted in to a long running one.
Is this how it is suppose to be?
1. First page render, cid=1
2. Post back to @Begin(join=true) action method. cid=1 gets promoted to long running.
3. Returns from postback, and renders the same page. cid=1
For me it doesn't work like above, at step 3 cid=2
Many thanks,
Mike -
6. Re: Conversations doing my head in - help
jacob.orshalick Jan 20, 2008 2:59 PM (in response to mail.micke)"mail.micke@gmail.com" wrote:
Is this how it is suppose to be?
1. First page render, cid=1
Yes. This first rendering starts a temporary conversation which is cid=1. Once the page is rendered that temporary conversation is destroyed."mail.micke@gmail.com" wrote:
2. Post back to @Begin(join=true) action method. cid=1 gets promoted to long running.
No, another temporary conversation is started with cid=2 on the post back. Every request has a temporary conversation unless a long-running conversation is being resumed. If you log the conversation id in your @Begin method you will see cid=2.
Hope that clears things up. -
7. Re: Conversations doing my head in - help
mail.micke Jan 20, 2008 3:05 PM (in response to mail.micke)Ok,
so if I press the submit button again, then the cid should still be 2 right? -
8. Re: Conversations doing my head in - help
jacob.orshalick Jan 20, 2008 3:08 PM (in response to mail.micke)Yes, since the action is annotated with @Begin(join=true). If join=true was not there you would get an exception.
-
9. Re: Conversations doing my head in - help
mail.micke Jan 20, 2008 3:18 PM (in response to mail.micke)Hi,
thanks for your patience :)
Here is where I have problems, the cid still gets incremented (and doing my head in). Or at least I think so, pretty sure I tested this. Will make sure again tomorrow at work.
I wonder what I've done wrong? And isn't it also a bit strange that the s:button/link don't call my action method?
I bet this is going to be one of those problems where I've done something silly.
Thanks again,
Mike -
10. Re: Conversations doing my head in - help
kukeltje Jan 20, 2008 3:56 PM (in response to mail.micke)the s:button/link does not call your action method if the form on the page contains validation errors. I've been struggling with this for over a day once. Maybe you have the same problem
-
11. Re: Conversations doing my head in - help
mail.micke Jan 21, 2008 3:56 AM (in response to mail.micke)I'm having the problem I thought I had, second click on the command button calling an action with @Begin(join=true) gets a new conversation id.
And I was wrong about the action not getting invoked with the seam ui components, they just don't seem to go through the usual jsf lifecycle (don't get the printouts from my timer phase listener).
Here is some more code, can you guys see anything wrong?@Name("dataSearch") @Scope(ScopeType.CONVERSATION) public class DataSearch { private String pattern; @In("#{DataService}") private DataService dataService; boolean onlyColl = false; boolean withPrivate= false; List<Data> results; @Begin(join=true) public String search(){ System.out.println("Conversation id in action: " +Conversation.instance().getId()); if(results == null){ System.out.println("results is NULL"); results = dataService.getData(pattern, onlyColl, withPrivate); } return null; } //cut
And here is the XHTML body content :#{conversation.id} <h:form> Search pattern: <h:inputText value="#{dataSearch.pattern}"/> <s:link value="SeamLinkSearch" action="#{dataSearch.search}"/> <s:button value="SeamButtonSearch" action="#{dataSearch.search}"/> <h:commandButton action="#{dataSearch.search}" value="search"/> <a4j:commandButton action="#{dataSearch.search}" value="ajax search" reRender="searchResult"/> <a4j:status startText="Working..." stopText=""/> <rich:dataTable id="searchResult" rendered="#{not empty dataSearch.results}" value="#{dataSearch.results}" var="row" rows="10"> <f:facet name="header"> <rich:datascroller for="searchResult"/> </f:facet> <rich:column> <f:facet name="header"> Code </f:facet> #{row.code} </rich:column> <rich:column> <f:facet name="header"> Name </f:facet> #{row.name} </rich:column> </rich:dataTable> <rich:messages showDetail="true"/> </h:form>
-
12. Re: Conversations doing my head in - help
mail.micke Jan 21, 2008 5:08 AM (in response to mail.micke)Hi
I just noticed that addingpropagation="join"
to the s:button, starts a conversation and I get a "Beginning Conversation" log message.
But when clicking the s:button I notice that the dataSearch.pattern property is not set on my backing bean.
Any ideas?
Cheers -
13. Re: Conversations doing my head in - help
pmuir Jan 21, 2008 5:31 AM (in response to mail.micke)s:button/s:link DO NOT SUBMIT THE FORM!
-
14. Re: Conversations doing my head in - help
mail.micke Jan 21, 2008 5:39 AM (in response to mail.micke)Just re-read the docs and noticed the bit which says that the seam button doesn't submit the form.
Also discovered the s:conversationPropagation tag.
It seems to work just fine when using it with a h:commandLink , but not with h:commandButton.
Anyway, sorry for the rant.
Should the @Begin annotation work for me?