1

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?

Bono
  • 4,757
  • 6
  • 48
  • 77
falcorn
  • 21
  • 4
  • 1
    requestBean (**R**equestBean?) does not extend anything, how can it have access to tableType then? Or do you just want 'tableType' to be injected and not the full bean? In JSF you can't. And why is getting the full bean injected a problem? Maybe you have to redesign and create a class for tableType and make that 'managed'. In CDI you can use `@Produces` on the tableType in the baseListBean btw, but that requires changing from jsf managed beans to cdi managed beans (which is not wrong btw) – Kukeltje May 14 '16 at 09:04
  • since `BaseListBean` is not a `@ManagedBean` , how can inject the full bean? – falcorn May 14 '16 at 12:12

0 Answers0