Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

How can I access one Managed Bean from another?

...

Using Dependency Injection

Using JSF 2 @ManagedProperty annotation

In your managed bean add a @ManagedProperty annotation to the related property and don't forget to add getter and setter methods.

...

Binding through faces-config.xml

In your project's faces configuration file which defines the managed beans, a managed bean
property can be declared as initialised with a reference to another managed bean:

...

The constraints are that:

...

The following java code can be used in MyFaces 1.1 to explicitly look up an arbitrary managed bean by name:

...

...

In MyFaces 1.2, that code is deprecated, and preffered version is:

...

...

Alternately,

...

you

...

can

...

use

...

this

...

code

...

to

...

evaluate

...

any

...

JSF

...

EL

...

expression.

...

...