Wednesday Jan 28, 2015

MAF 2.1 - New task Flow PageFlow Scope Default: push-new

MAF 2.1 has been released to public and the New features document mentions a feature provides a behavior to task flows that is familiar for ADF developers:

"Support for limiting pageFlowScope variables to task flow boundaries

MAF 2.1.0 provides the ability to restrict the scope of a pageFlowScope variable to the bounded task flow only. Any updates to the variable in one bounded task flow would not impact a pageFlowScope variable with the same name in another bounded task flow. To force this behaviour, the following flag must be set:


Without this flag, the default behavior matching previous MAF releases will be enforced, such that changes made to the variable in the second bounded task flow would impact the variable in the first bounded task flow."


What the new feature document doesn't tell you is where this flag needs to be set. Here is where our MAF documentation comes into play (Our doc writers really do an amazing job in keeping up with the changes in this so quickly evolving product. Plus the way they explain the product is - at least in my opinion - outstanding work):

" What You May Need to Know About Behavior of New Bounded Task Flows

The value of the page-flow-scope-behavior element is set to push-new by default and is displayed in the Overview and Source editors for the new task flow, as well as the Properties window for the task-flow-definition element"


So the good news is that this is the default behavior now. Another good news is that the product doesn't enforce this setting on applications that are upgraded from MAF 2.0.1 or even ADF Mobile. However, after analyzing your applications, you should switch to this  setting if you can make sure that this doesn't negatively impact your application.

The reason why you want to move to using the new default setting (push-new) is isolation of your managed beans or variables you save in pageFlowScope. MAF does not support reuse on the task flow level. But even without, if you treat task flows as units of work and an ability to split the work within development teams, you can see how a conflicting name of a memory variable could cause funny side effects if an old value set in the parent task flow is shown. In addition task flows could be the only feature in a FAR file, which then would be similar to reusing task flows on a task flow level. If you make assumption about the existence of a shared pageFlowScope variable, where could this get you to?

 So architecture wise, ensure page flow scopes of bounded task flows are isolated and use task flow input parameters to share data between a called and a calling task flow. This puts you onto the safe side of life and the new MAF default setting supports you with this.

Thursday Jun 21, 2012

OEPE with ADF binding support available: Total Eclipse

The current release of Oracle Enterprise Pack for Eclipse, though in technology preview, brings Oracle ADF binding to the Eclipse IDE. You can download the Software from the link below:

Oracle Enterprise Pack for Eclipse ( Technical Preview New June 2012
Certified on Windows 7/XP/Vista, MacOS, and Linux. Supported on JDK 6.

For many Eclipse users, ADF is new and therefore I expect them to need guidance and help in case they run into issues they don't know how to recover from. Similar, ADF users familiar with Oracle JDeveloper that want to give OEPE a try, will find things different in Eclipse and thus may have questions. 

For both audiences I suggest to post issues to the OEPE forum on the Oracle Technology Network: I'll extend my OTN monitoring to include the OEPE forum on a daily basis to learn about developer needs, requirements and - of course - to catch bugs that need to be filed. From my side this is a part-time involvement, which means that the more ADF questions show on the forum, the more help I could need in answering them. The OTN forum for JDeveloper in my opnion wouldn't be the right place to go to unless the question is a generic ADF question that is not dependent on the integration in Eclipse.

Here's the OEPE forum link for a start


Wednesday Apr 18, 2012

Task Flow navigation using QueueActionEventInRegion on ADF Region

A common requirement in Oracle ADF is to perform navigation within an ADF region triggered by the parent page. While contextual event is one option to perform this task, the queueActionEventInRegion method exposed on the RichRegion instance is another. The queueActionEventInRegion performs navigation following control flow cases defined for the current view exposed in the region. Control flow cases can be flows that are defined from the view activity to a next activity or wild card control flow cases.

The easiest way for developers to access the RichRegion instance of an af:region tag is to use its Binding property and point it to a managed bean. Once you have a handle to the RichRegion, you can perform navigation from any event raised on the parent view (e.g. menu items action, command button action, value change events etc.)

//process navigation
public String navPickerAction() {
  //get selected navigation option
  String navigationCase = this.currentNavOption;
  RichRegion region = this.findRegionById("adfRegion1");
                                  null, null,false, 0, 0, PhaseId.INVOKE_APPLICATION);     
  return null;
//Create Method expression    
private MethodExpression createMethodExpressionFromString(String s){
  FacesContext fctx = FacesContext.getCurrentInstance();
  ELContext elctx = fctx.getELContext();
  ExpressionFactory exprFactory = fctx.getApplication().getExpressionFactory();
  MethodExpression methodExpr = exprFactory.createMethodExpression( 
                 new Class[]{});  
  return methodExpr;

Another useful method on the RichRegion instance is the ability to peek into the region for control flow cases defined for the current view. The following code reads the control flow cases that are defined for a view in a region to build a list of SelectItem for use in an af:selectOneChoice

//read the navigation case list from the region capabilities
public ArrayList<SelectItem> getNavlist() {
   RichRegion region = this.findRegionById("adfRegion1");
   Set<String> capabilities = region.getRegionModel().getCapabilities();
   navlist = new ArrayList<SelectItem>();
   for(String navcase : capabilities){            
     SelectItem item = new SelectItem();
   return navlist;

The JDeveloper sample workspace you can download at the end blog article contains implementations for all RichRegion methods: queueActionEventInRegion, getCapabilities and RegionNavigationListener


The select one choice in component in the sample always shows the control flow cases that are defined for the current view in the ADF Region (just for fun, you may want to add some wild card navigation flows in the task flow and then re-run the application to see that the control flow cases are dynamically looked up). Using the Region Navigation Listener, navigating the region using the "Go to Employees" button on the view will update the select one choice component in the parent view.

Get the sample application from here and make sure you configure the database connect to point to the HR schema of your local Oracle database.

Download Sample

Wednesday Mar 28, 2012

Gotcha when using JavaScript in ADF Regions

You use the ADF Faces af:resource tag to add or reference JavaScript on a page. However, adding the af:resource tag to a page fragment my not produce the desired result if the script is added as shown below

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1"
 <af:resource type="javascript">
  function yourMethod(evt){ ... }

Adding scripts to a page fragment like this will see the script added for the first page fragment loaded by an ADF region but not for any subsequent fragment navigated to within the context of task flow navigation. The cause of this problem is caching as the af:resource tag is a JSP element and not a lazy loaded JSF component, which makes it a candidate for caching.

To solve the problem, move the af:resource tag into a container component like af:panelFormLayout so the script is added when the component is instantiated and added to the page. 

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1"
 <af:resource type="javascript">
    function yourMethod(evt){ ... }

Magically this then works and prevents browser caching of the script when using page fragments.

Monday Mar 19, 2012

URL Task Flow vs. WSRP Portlets

A URL task flow is bounded task flow that is deployed as a stand-alone Java EE application on a remote server with its URL Invoke property set to url-invoke-allowed. The URL task flow is accessed either from a direct browser GET request or, when called from another ADF application, through the task flow call activity.

For more information about how to invoke URL task flows from a task flow call activity see chapter 15.6.4 How to Call a Bounded Task Flow Using a URL of the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework at

Compared to WRSP portlets, URL task flows in Oracle JDeveloper 11g R1 and R2 have a functional limitation in that they cannot be embedded as a region on a page but require the calling ADF application to navigate off to another application and page. The difference between a URL task flow call using the task flow call activity and a simple redirect to a remote Java EE application is that the URL task flow has a state token attached that allows to restore the state of the calling application upon task flow return.

A use case for a URL task flow call activity is a "yellow page lookup" scenario in which different ADF applications use an URL task flow to lookup people, products or similar to return a selected value to the calling application.

Note that URL task flow calls need to be performed from a bounded or unbounded top level task flow of the calling application. If called from a region (using the parent call activity) in a page, the region state is not recovered upon task flow return.

ADF developers recently have identified URL task flows as an architecture pattern to partition their ADF applications into independently deployed Java EE applications. While this sounds like a desirable use of the URL task flow feature, it is not possible to achieve for as long as URL task flows don't render as an ADF region.

Thursday Feb 23, 2012

How-to define a default action for page fragments

The af:form component has a DefaultCommand property that, when set to the component Id of a command component like af:commandButton invokes the associated command action when the enter key is pressed anywhere in this form. However, if the form fields are contained in a page fragment exposed in a region then using the DefaultCommand property may not be an option as it is difficult to predict the command button id and its surrounding naming containers.

A solution to this is to use JavaScript on the UI input components that, when the Enter key is pressed virtually press a button within the page fragment (note that the af:form element belongs to the parent page and that you can only have a single af:form component per browser page)

Let's assume a page fragment with a single input text component and a command button to press:

<af:panelFormLayout id="pfl1">
  <f:facet name="footer">
     <af:commandButton text="Print Field Value" id="cb1" partialSubmit="true"                                            
                       clientComponent="true" action="#{View1Bean.onButtonPressed}"/>
   <af:inputText label="Enter Field" id="it1" binding="#{View1Bean.inputTextField}">
      <af:clientListener method="onFieldEnterKey" type="keyUp"/>

The command button is bound to a managed bean action method. By default, the action method is invoked when users press the command button. However, with the JavaScript shown next, this can be simulated and mapped to the Enter key press in the text field.

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1"

<af:resource type="javaScript">
   //function called by the client listener

  function onFieldEnterKey(inputEvent){
    if (event.getKeyCode() == AdfKeyStroke.ENTER_KEY) {
      //get the input text component from the event            
      var inputTextField = inputEvent.getSource();
      //the button is relative to the input text field so
      //relative search will do with no worrying about naming
      var defaultButton = inputTextField.findComponent('cb1');
      //perform a partial submot
      var partialSubmit = true;
      //Enter key does not need to go to server as we
      //queued a new event

For JavaScript to work, note the use of the af:clientListener on the input text field and the use of the clientComponent="true" configuration on the button.

Monday Jan 09, 2012

Oracle JDeveloper 11.1.2 ADFc Savepoint Script

The save point (save for later) feature of the ADF Controller is enabled from Application Resources | Descriptors | ADF META-INF in the Application Navigator. To enable controller save points, double click onto the adf-config.xml file and assign a data source name to the Savepoints | Data Source property using the magnifying glass.

In JDeveloper 11g R1, make sure the account accessing the schema into which save points should be stored has the create table permission granted. Background for this requirement is that the save point table is automatically created the first time a save point is written by the controller. After this the create table permission can be removed from the account. As you guessed it, this approach is not a DBA's darling, which is why an external script is provided in 11g R2.

In JDeveloper 11g R2, an external script - adfc_create_save_point_table.sql - is provided for you t create the save point table in advance. The script is located in the oracle_common\common\sql directory of the JDeveloper 11g installation home.

Tuesday Jun 28, 2011

Five hours of Task Flow Overview Recordings Available

In addition to the ADF Controller task flow documentation in Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1

The ADF Insider website …

… hosts five online videos that explain how to build and work with ADF Controller task flows in Oracle ADF.

ADF Task Flow - Overview (Part 1)

This 90 minute recording introduces the concept of ADF unbounded and bounded task flows, as well as other ADF Controller features. The session starts with an overview of unbounded task flows, bounded task flows and the different activities that exist for developers to build complex application flows.

Exception handling and the Train navigation model is also covered in this first part of a two part series. By example of developing a sample application, the recording guides viewers through building unbounded and bounded task flows. This session is continued in a second part.

ADF Task Flow - Overview (Part 2)

This 75 minute session continues where part 1 ended and completes the sample application that guides viewers through different aspects of unbounded and bounded task flow development. In this recording, memory scopes, save for later, task flow opening in dialogs and remote task flow calls are explained and demonstrated. If you are new to ADF Task Flow, then it is recommended to first watch part 1 of this series to be able to follow the explanation guided by the sample application.

ADF Region Interaction - An Overview

This session covers most of the options that exist for communicating between regions. It briefly discusses what it takes to build regions from bounded task flows before going into details using slides and samples. The following interaction is explained: contextual events, queue action in region, input parameters and PPR, drag and drop, shared Data Controls, parent action and region navigation listener.

ADF Region Interaction - Contextual Events

Contextual event is used as a communication channel between a parent view and its contained regions, as well as between regions. By example, this session explains how to set up contextual events, how to define producers and event listeners and how to define the payload message.

Tuesday May 10, 2011

How-to efficiently redirect an ADF Faces view using ADFc

ADF Faces developers use facesContex.getExternalContext().redirect(String) to issue a GET request to a JSF view. Using ADFc, the redirect URL should neither be read from the current UIView root directly or provided in the form /faces/<viewId name>. Instead, have the controller generating the redirect String for a specific viewId as shown below:

FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();

String viewId = "... add viewId...."
ControllerContext controllerCtx = null;
controllerCtx = ControllerContext.getInstance();
String activityURL = controllerCtx.getGlobalViewActivityURL(viewId);

} catch (IOException e) {
//Can't redirect


Why? Because a redirect is a Get request and you don't want ADFc to treat it as a new application request but instead retrieve the internal controller state. For this you need the state toke in the redirect URL, which is what the code line above does


A blog on Oracle JDeveloper, ADF, MAF, MCS and other mobile and web topics inspired by questions and answers posted on the OTN forums.

Frank Nimphius


« March 2015