0 Replies Latest reply on Oct 6, 2010 12:35 AM by George Gastaldi

    New Scope in Weld ? (CDI)

    George Gastaldi Master

      Hello, I have a scenario that maybe you guys could help me out:


      I am using Weld 1.0.1-Final and JSF 2.0.2.FCS Reference implementation.


      Every new use case developed on my application uses the keyword entity in EL to define the current entity being maintained and action to define the controller for my facelets page. A use case is composed one web page.


      There are backing beans for these keywords (using @Named) and I have two methods annotated with @Produces to decide which object will bind to these keywords. The implementation is irrelevant.


      However, I am facing a certain difficulty to decide which scope these keywords will be stored.


      After some thoughts, I realized that two scopes may be used: @ConversationScoped and @ViewScoped. However, there are some drawbacks on that:


      - If I use @ViewScoped (using the implementation provided by seam-faces module), the objects will be shared among different browser tabs for the current session (same URL).


      - If I use @ConversationScoped (provided by Weld), when the conversation is propagated to another page (that has its own entity and action instance) these objects will not be recreated, because the conversation is the same, so there is no point in rebinding the instances for these objects.


      I think a scope that uses these two scopes might be a better solution, like, storing the viewId in conversation backed by a map (that stores the View Scope)


      Am I missing something ?


      Does anyone faced a problem like mine ?   


      Thanks