How to inject a property from an abstract base bean to another managed bean

271 views Asked by At

I have the abstract class BaseListBean which has a tableType:

public abstract class BaseListBean {
     private String tableType;
}

The child beans look like this:

@ManagedBean
@ViewScoped
public class FunctionListBean extends BaseListBean {
   ...
}

My question is: how can I access tableType from another managed bean?

@ManagedBean(name="requestBean")
@RequestScoped
public class requestBean {
    //this is needed
    private String tableType;

}

What is working right now is using the child beans as managed properties e.g. functionListBean:

@ManagedProperty(value = "#{functionListBean}")
private FunctionListBean functionListBean

and then

functionListBean.tableType

But what I want is the tableType of the currently existing Bean, so how could I do it?

0

There are 0 answers