First page Back Continue Last page Text

oracle adf workshop

Notes:


EL Used in Managed Beans

Although the primary use of EL is in the page definitions, you can also use EL in seeding managed bean properties, or in Java code. In the case of managed properties, the dependencies cascade during the resolution process. In this example, because the userbean is referenced first, JSF sets the managed property for userType (calling the .setUserType()method on the User object instance), but to get the value to set it also either resolves or instantiates a new instance of the reference bean (definition not shown here).

There are scoping rules that define what scopes of the managed bean are visible to other managed beans—for instance, a bean defined in the session scope is visible to a request-scope bean, but not visible to an application-scope bean.

Finally, EL has both positive as well as negative aspects.

EL provides you with an untyped abstraction for object references. It is convenient to use and very powerful. However, this abstraction is in itself a weakness. EL is metadata and is not compiled at design time. Consequently, a mistype in an expression is enough to break the binding and cause a run-time error.

To counter this issue, when using an IDE such as JDeveloper, the compilation process should encompass and validate the metadata source files as well as the Java source and verify that EL references are (as far as possible) valid.