-
1. Re: How to access a seam component from a Phase Listener?
pmuir Jul 18, 2008 11:44 PM (in response to kenclark)Use Component.getInstance() but only after the restore phase.
-
2. Re: How to access a seam component from a Phase Listener?
kenclark Jul 19, 2008 4:23 AM (in response to kenclark)Excellent! Thank you.
It seems like just retrieving the object this way does not in itself put the object into the Page scope, so I have tried this:
Contexts.getPageContext().set("usercfg", userConfig);
But it does not seem to be doing what I want it to do. Is there something incorrect in this code?
I am trying to force a value into the page scope from page to page for downstream use, but as soon as I leave the page where I am directly Outjecting the value, it is lost. I was hoping I could bridge that gap using a PhaseListener.
The component class is basically:
@Name("usercfg") @Scope(ScopeType.PAGE) @AutoCreate public class UserConfig implements Serializable { // ... }
Note: I am still trying to find a solution to the problem I originally posted at: wiki://32052.
Thanks,
ken -
3. Re: How to access a seam component from a Phase Listener?
kenclark Jul 20, 2008 12:24 AM (in response to kenclark)I understand things a little better now and realize that what I am trying to do fundamentally will not work using the PAGE scope, because PAGE does not survive through a redirect. So the first redirect I hit ends the series I need to continue unbroken.
I have tried a little bit with conversation, since (so I thought) there would always be a conversation between two pages -- even through a redirect -- either a long-running or temp conversation. This works much better, but the first time I pass through a
s:link with propagation="none"
I lose the values.So I am going to research Seam scopes more to see if I can find a way past this wall. Any suggestions are appreciated.
Thanks,
ken -
4. Re: How to access a seam component from a Phase Listener?
luxspes Jul 20, 2008 1:22 AM (in response to kenclark)That is because <s:link with propagation="none"> is precisely for losing the values. (propagation="none" means
no propagation of conversation (and therefore no propagation of values inside the conversation)
)I find it a little odd (I hope that you take no offense) that you think it may be easier to modify the internal workings of Seam. and create new ScopeType than trying to understand current Seam ScopeTypes (and see if they help you do what you need)