X

The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    January 31, 2011

How to deploy global managed beans

Frank Nimphius
Master Principal Product Manager

"Global managed" beans is the term I use in this
post to describe beans that are used across applications. Global managed beans
contain helper - or utility - methods like or instead of JSFUtils and ADFUtils.
The difference between global managed beans and static helper classes like JSFUtis
and ADFUtils is that they are EL accessible, providing reusable functionality
that is ready to use on UI components and - if accessed from Java - in other managed
beans.

For example, the
ADF Faces page template (af:pageTemplate)
allows you to define attributes for the consuming page to pass in object
references or strings into it. It does not have method attributes that allow command
components contained in a template to invoke listeners in managed beans and the
ADF binding layer, or to execute actions. To create templates that provide
global button or menu functionality, like logon, logout, print etc., an option
for developers is to deployed managed beans with the ADF Faces page templates. To
deploy a managed bean with a page template, create an ADF library from the
project containing the template definition and import this ADF library into the
target project using the Resource palette. When importing an ADF library, all
its content is added to the project, including page template definitions, managed
bean sources and configurations.

More about page templates

http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e12419/tagdoc/af_pageTemplate.html

Another use-case
for globally configured managed beans is for creating helper methods to be used
in many applications. Instead of creating a base managed bean class that then is
extended by all managed beans used in applications, you can deploy a managed
bean in a JAR file and add the faces-config.xml file with the managed bean configuration
to the JAR's META-INF folder as shown below.











Using a globally configured managed bean allows you to use
Expression Language in the UI to access common functionality but also use Java
in application specific managed beans. Storing the faces-config.xml file in the
JAR file META-INF directory automatically makes it available when the JAR file
is found in the class path of an application.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.