Change the scope of a Bean dynamic

Hi,

I managed to inject a bean dynamically:

Map sm = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();

TestBean tb = new TestBean();

sm.put("testBean", tb);

now my question is:

I didn't define the bean in the faces-config, because it is dynamic and so I can't know in andvance how many new beans will be produced. Now, how can I set the scope of the new created bean?

Is there a default?

Any idea?

Cheers

[489 byte] By [pekiti-tirsiaa] at [2007-11-26 17:46:11]
# 1
In theory, just create an abstract bean class and define it for each scope. Then let the new bean implement or extend from it.But this is weird practice though. What are the requirements? What do you want to achieve?
BalusCa at 2007-7-9 0:14:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Well, we are working with ajax and need to create tabs in a tab panel dynamic.The content of these panels comes from backing beans and we don't know in advance what class this beans have.Thats the idea.Cheers
pekiti-tirsiaa at 2007-7-9 0:14:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...