This content has been marked as final.
Show 4 replies
-
1. Re: Conversation binding workaround
pmuir Apr 20, 2007 7:48 PM (in response to vineetmanohar)Exactly.
@Name("binding") @Scope(EVENT) public class Binding { // Do your binding here }
@Name("numberGuess") @Scope(ScopeType.CONVERSATION) public class NumberGuess implements Serializable { @In Binding binding // Do work on the binding in your method }
-
2. Re: Conversation binding workaround
vineetmanohar Apr 23, 2007 12:06 PM (in response to vineetmanohar)Thanks for you reply, that was very helpful.
So suppose I created a seam component called "binding" with EVENT scope as you have suggested, how can I initialize it? I want to set the value of this component from my Conversation component "numberGuess".
Can I @Out-ject the value from Conversation to Event scope? -
3. Re: Conversation binding workaround
pmuir Apr 23, 2007 12:12 PM (in response to vineetmanohar)Yes
@Name("numberGuess") @Scope(ScopeType.CONVERSATION) public class NumberGuess implements Serializable { @In(create=true) @Out Binding binding; @Create public void createBinding() { binding.setFoo("bar"); } // Do work on the binding in your method }
-
4. Re: Conversation binding workaround
vineetmanohar Apr 23, 2007 4:06 PM (in response to vineetmanohar)Thanks again for the reply. I tried exactly what you said and ran into a problem.
binding="#{binding.myBean.myComponent}": Target Unreachable, 'myBean' returned null
I debugged and found that my @Create method in NumberGuess was not called yet. Therefore the @Out-jection did not occur yet. It seems that when I access the numberGuess.xhtml page, the bindings are first resolved on the xhtml page first, and then the conversation is started which and that is when my @Create method is called.
I start the conversation by typing the /numberGuess.xhtml url in the browser. I have the following entry in my pages.xml<page view-id="/numberGuess.xhtml"> <begin-conversation join="true" pageflow="numberGuess"/> </page>
How can I first start my conversation and then redirect to the view? How can I start a conversation by typing a URL but using start-state, instead of start-page?