0 Replies Latest reply on Feb 22, 2009 1:25 PM by dxxvi

    What is the best (place, scope) for a bound component?

      In the conventional JSF and from the JSF specification, a bound component (for example, an org.richfaces.component.html.HtmlTabPanel instance which is bound to some <rich:tabPanel> should be in the request scope).


      In Seam, I wonder where it can be:


      - Stateless scope: I don't think it can be here because if I refer to that component multiple times on a page then it's wrong.


      - Event scope: of course because Seam's event scope = servlet request scope


      - Page scope: this component is stuck on the JSF component tree where all other components on that page are. Even if I re-render a part of the page, the JSF component tree's structure is unchanged (unless I use <c:if> in my page), so everything will be fine.


      - Conversation scope: if I have 2 Firefox tab with different conversation id, it's fine. If these 2 tabs have the same conversation id and are displaying the same JSF page (can it happen? I think yes), then there'll be problems.


      Could any body please confirm if I'm right or wrong?


      The reason for my question is: in JSF I cannot inject a shorter-lifetime bean to a longer-lifetime bean. So if my backing bean is session-scoped, the only way for me to access a bound component is using


      FacesContext.getCurrentInstance().getApplication().getExpressionFactory()
              .createValueExpression(...).getValue(FacesContext.getCurrentInstance())


      So my backing bean is request-scoped and contains bound components. The data I want to keep across http requests is in a session-scoped bean and is injected to that backing bean.


      I don't know if I can inject an event-scoped seam component into a conversation-scoped component. Could anybody confirm this?
      If I cannot do that, then most of my components which have action methods (i.e. methods which are called when links are clicked) must be event-scoped and my data will be in some conversation-scoped component which is injected into some event-scoped component (like what I did in the conventional JSF)?


      Thank you for any of your opinions.