Oracle ADF : Working with Parameters

Parameters accept and store values and can be very helpful in ADF applications.

There are many types of parameters as visualized below.



To demonstrate the above scenario let’s develop a ADF application,

Scenario: Lets have 3 buttons on a page & on press of each button renders different page fragments by passing the parameters as depicted in above pic.

Ø  Create a JSPX page – “Index.jspx” with no bindings, add 3 buttons with action listeners respectively with each action listener having a unique value, say first button has the following value  #{‘a’} stored to #{requestScope.ClickRec}, i.e this translates to ClickRec of requestScope variable storing a value – ‘a’ on clicking first button in laymen’s terms.


Ø  As the components on page is not bound to any data controls, no data bindings is created dynamically, so update this by right clicking on the page & create Page Definition and accept the defaults.
Ø  Navigate to Parameters Tab & create a parameter with the following id & value respectively – ClickRec and #{requestScope.ClickRec}. – Page Parameter

Ø  Now let’s add the “Index.jspx”  page, Wildcard control flow  & a “task flow call” activity(ButtonClick.xml) components to “adfc-config.xml” unbounded task flow.
Ø  Wire them with control flow case as depicted below.

Note: The task flow call activity – “ButtonClick” will have a warning icon, this is because the task flow is not yet created.
Ø  Right click on “ButtonClick” task flow call activity to insert inside Input Parameter with a Name & Value field as depicted above. – View Parameter
Ø  Create the bounded task flow – “ButtonClick.xml” (with Page Fragments unchecked) by double clicking.
Ø  Add a view (Home.jspx) & task flow return activity from Component Palette with “Home” view activity being default activity and wire it to return activity with “toIndex” as from outcome as depicted below.

Ø  Add the input parameters to the task flow as depicted below. – Task Flow Parameter

Note: The warning icon on the “Home” page is because it’s yet to be created.
Ø  Ignore for now & create a bounded task flow with page fragments – “ButtonClickFlow.xml” with the following components (Switcher & 3 fragments) as depicted below. – Task Flow Parameter

Ø  Go ahead and create it accepting default details.
Ø  Add input parameter value to the “ButtonClickFlow” taskflow as depicted above.
Ø  Return back to “Home.jspx” page creation in “ButtonClick” taskflow by double clicking and add a command link with the “toIndex” as action and also drop the “ButtonClickFlow” just created earlier, as region below the command link as depicted below.

Ø  Right click the region, select “Go to Page Definition” and add input parameter to the task flow in the executables with the values as depicted below. – Region Parameter

Ø  Save your work, return back to “ButtonClickFlow” task flow and configure the router with the following parameters to route to different fragments based on the criteria as depicted below. – Task Flow Parameter

Ø  Now click on each fragment to create new page fragments and mention some text to differentiate the button press action as depicted below.

Ø  Run the “Index.jspx” page to test.

Ø  On click of “Button 2” the expected output is achieved.



Comments

  1. Hi Ajit,

    Nice article,

    Just wanted to know if this is in a Taskflow that you are passing partameters between page fragments ? OR in different regions in ADF page.

    Your article seem to specifiy that it is a ADF page but explains about page fragments within a tasklow. Please clarifiy.

    Also, Let me know how to page parameters between two taskflows between two different regions within the same ADf Page.

    Regards

    ReplyDelete

Post a Comment

Popular posts from this blog

Oracle ADF: Add a Favicon to Page, Page Template

Oracle ADF : Dynamic Regions