Within a JSP you can use:
Object obj = Contexts.getConversationContext().get("foo")
(or any other context)
You can also do:
Object obj = Contexts.lookupInStatefulContext("foo")
But why is it for statefull contexes only. I used this:
Object obj = Contexts.getStatelessContext().get("foo");
And it didn't work for me. I mean no object was instantieted.
I studied a bit and noticed that it might be impossible to do such a thing (at leat now).
I noticed that, even when using Seam out side the container (test environment), and creating components with following code:
User user = (User) Component.getInstance("user", true);
We have to extend class SeamTest which simulates a mock JSF system. This is from manual:
Notice that we've extended SeamTest, which provides a Seam environment for our components, and written our test script as an anonymous class that extends SeamTest.Script, which provides an emulated JSF request lifecycle.
Component.getInstance("user", true) will work anywhere.
I think I found it. At least one JSF page should be viewed compelety before I can do such stuff. My problem was that, I tried to do above in my first JSP page. I just put a jsp forward in my first page and in the second page I had access to every thing :)
PS. Should'nt this be noted somewhere in manual.