If I want to create more than one instance of managed bean in JSF 2.0, under different names in the same scope, how should I proceed? Ideally, I want the equivilant to (for
In your case you should make use of the faces-config.xml. Implment your bean without the ManagedBean and RequestScope annotation. So your bean will not become a managed bean per default. You can than instance as much managedBeans as you need with different names, different scopes and at lease differnent properties. For example:
MyManagedBean1
org.MyManagedBean
session
value1
int
5
value2
int
2
MyManagedBean2
org.MyManagedBean
view
value1
int
30
value2
java.lang.String
project
Don't think that descriptors are evil and annotations are the only way to implement your code.