jsf - Get new instance of session scoped bean with other name -


i have session scoped bean ui edit data. annotated @named , @sessionscoped , runs in jboss 6.2. got requirement similar edit ui. problem 2 uis can exist in parallel. perfect reuse nice create new instance of bean name. unfortunately have no clue how in clean cdi way. don't inherit bean , give name. 1 of ideas. idea implement in managed bean business logic , keep data encapsulated them , set data object inside managed bean when needed in specific context. maybe there cdi way producers or something? changing scope of bean viewscope makes no sense in case.

thanks oliver

but maybe there cdi way producers or something

indeed, could use producer.

kickoff example:

@sessionscoped public class sessionbean {      @produces     @named("foo")     @sessionscoped     public sessionbean getasfoo() {         return new sessionbean();     }      @produces     @named("bar")     @sessionscoped     public sessionbean getasbar() {         return new sessionbean();     }      // ... } 

(method names free choice)

usage:

@inject @named("foo") private sessionbean foo; 
@inject @named("bar") private sessionbean bar; 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -