You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 25 Members of 3082 |
| Forum: Seam Users |
18. Jul 2008, 23:09 CET | Link |
I assume I can't use injection in a Phase Listener, so how would I go about accessing a named Seam component (which will be in the Page scope)?
Correspondingly, how can I make sure it is stored in the next page scope? Thanks, ken
Use Component.getInstance() but only after the restore phase.
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: How to handle by-browser-page scope.
Thanks, ken
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
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
That is because <s:link with propagation="none"> is precisely for losing the values. (propagation="none" means )
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)
I believe that imagination is stronger than knowledge -- myth is more potent than history -- dreams are more powerful than facts -- hope always triumphs over experience -- laughter is the cure for grief -- love is stronger than death.