-
1. Re: Conversation - setting and getting
pmuir Jun 19, 2007 4:54 AM (in response to urosmil)"urosmil" wrote:
1) is it possible to set conversation scope in faces-config.xml; in the same way as for session scope:<managed-bean-scope>session</managed-bean-scope>
No. And a bean declared in faces-config.xml isn't a Seam component.2) how go get conversation scoped bean through java code, as it's possible for session scoped bean:
Contexts.lookupInStatefulContexts("foo")
orContexts.getConversationContext().get("foo")
-
2. Re: Conversation - setting and getting
urosmil Jun 19, 2007 8:04 AM (in response to urosmil)Hi petemuir,
both "Contexts.lookupInStatefulContexts("myBean")" and "Contexts.getConversationContext().get("myBean")" return null when I try to get conversation bean in session scoped bean.
I open pop-up window from conversation bean (offerBean). That pop-up use other session scoped bean (offerPreviewBean). Inside offerPreviewBean I try to access offerBean and I got null.
Is there some conditions in which code you post doesn't work?
Thanks,
Uros! -
3. Re: Conversation - setting and getting
pmuir Jun 19, 2007 8:12 AM (in response to urosmil)Are you propagating the conversation to the popped up window?
-
4. Re: Conversation - setting and getting
urosmil Jun 19, 2007 8:17 AM (in response to urosmil)Hi petemuir,
pop-up is not in conversation. I don't it should be inside conversation. Pop-up use other session scoped bean.
Am I making mistake in use?
In what situations is possible to access conversation scoped bean?
Thanks,
Uros! -
5. Re: Conversation - setting and getting
urosmil Jun 19, 2007 9:54 AM (in response to urosmil)Hi,
I will explain my problem hopping someone can help:
From page which is in conversation I open pop-up window with url: offer.jsf?lang=en&id=173&type=offerId. Page offer.jsf use session (doesn't need to be session; can be request to) scoped bean "offerPreviewBean". In "offerPreviewBean" bean I try to access conversation scoped bean "offerBean".
Is this possible and if it isn't how to solve this problem?
I can explicitly add objects I need in session but if I use that practice I'm moving back to JSP world.
Thanks,
Uros! -
6. Re: Conversation - setting and getting
pmuir Jun 19, 2007 11:08 AM (in response to urosmil)Ok, fair does. Can you post the content of the popup window and any beans you call off it (offerPreviewBean, offerBean).
-
7. Re: Conversation - setting and getting
urosmil Jun 19, 2007 11:27 AM (in response to urosmil)Hi petemuir,
this is link:offer.jsf?lang=en&id=173&type=offerId
this is pages.xml part:<page view-id="/offer.xhtml"> <param name="lang" value="#{offerPreviewBean.lang}"/> <param name="id" value="#{offerPreviewBean.id}" converterId="javax.faces.Integer"/> <param name="type" value="#{offerPreviewBean.offerIdType}"/> <action execute="#{offerPreviewBean.setOffer}"/> </page>
this is OfferBean:@Name("offerBean") @Scope(ScopeType.CONVERSATION) @Conversational(ifNotBegunOutcome = "offerBook") public class OfferBean extends BaseBean{ // ... }
this is OfferPreviewBean:@Name("offerPreviewBean") @Scope(ScopeType.SESSION) //ScopeType.EVENT public class OfferPreviewBean extends BaseBean{ public OfferPreviewBean() { offerBean = (OfferBean) Contexts.getConversationContext().get("offerBean"); } }
I think other code is not relevant because in use case where "offerBean" object in OfferPreviewBean bean is not needed pop-up is working perfectly.
Thanks,
Uros!