-
1. Re: How to ask Seam to instantiates a component without JSF
theute Oct 17, 2005 2:40 AM (in response to amin59)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") -
2. Re: How to ask Seam to instantiates a component without JSF
amin59 Oct 17, 2005 3:12 AM (in response to amin59)Yes,
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. -
3. Re: How to ask Seam to instantiates a component without JSF
amin59 Oct 17, 2005 4:50 AM (in response to amin59)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.
-
4. Re: How to ask Seam to instantiates a component without JSF
gavin.king Oct 17, 2005 8:18 AM (in response to amin59)Component.getInstance("user", true) will work anywhere.
-
5. Re: How to ask Seam to instantiates a component without JSF
amin59 Oct 18, 2005 3:27 AM (in response to amin59)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.