Wednesday May 23, 2012

Adding LOV to non-database Field or Parameters

More and more people end up using ADF for applications that don't actually talk to a database backend but rather to Web services, Java classes, and SOA process instead. In these cases the ADF pages actually end up invoking methods and passing parameters to these methods. One question I got today was "how do I add a database driven LOV to such a parameter?".

The tricky part is that the LOV component - af:inputListOfValues - expects a specific data model to be able to show the advance searching the LOV offers. As a lazy developer I don't feel like creating a managed bean with this model and populating it manually from the database. Instead here is a little video that shows a no-coding possible solution.

I'm using ADF BC to get the LOV and data from the database. I then use a bit of binding trickery to eliminate the need for a managed bean with the model structure for the LOV. I associate the LOV model created for an ADF BC field with an LOV field that is mapped to the parameter being passed to the method.

Tuesday Dec 28, 2010

Combining Multiple Queries and Parameters into One Operation

This question came up twice this week and while the solution is explained in a couple of previous blog entries I did, I thought that showing off the complete solution in a single video would be nice.

The scenario is that you have two VOs with queries that are based on a parameter, I showed in the past how to create a parameter form that executes the query - and you can do this for both.
But what if you actually need just one value to drive both queries? How do you combine two parameter forms and two buttons into one?

This is what this video shows you. The steps are:
Creating two parameter forms
Setting the value of a parameter in the binding tab
Creating a backing bean to execute the code for one button
Adding the code to execute another operation
Remarking the parts that can be dropped from the screen

Check it out here:

Thursday Aug 05, 2010

Delay Method Execution When Using ADF Binding

When you bind a method to an ADF page and also include the results of the method on the page , by default ADF will try to execute the method when the page displays so the results can be populated.
However in many cases you actually want to delay this execution until you actually provide some parameters to the method.

You can do this by playing around with the value of the refreshCondition property of the executable binding.
In the video below I show how to expose an EJB method that accepts parameters in a JSF page, and how to show the results on the same page.
Then I show how to prevent the initial method execution if there is no parameter being passed to the method.

Friday May 14, 2010

Update/Insert With ADF Web Service Data Control

The Web service data control (WSDC) in ADF is a powerful feature that allows you to easily build a UI on top of WS interfaces exposed by other systems.

However when you drag a WSDC to a page you usually get a set of output components where the data is shown. So how would you actually do an update operation on those values?
The answer is that you need a call to another method in your WSDC that does the update - but what if you want to pass to it the actual values that you get from the get method you invoked before?

Here is a demo showing how to do that:

The two tricks that are shown here are:
Changing the properties of items in the DC to be updateable - this gives you inputText fields instead of outputText fields.
And passing the currentRow.dataProvider to the update method (and choosing the right iterator for this).

Friday Apr 23, 2010

Doing two Declarative Operations with One Button

You can file the below video under "things that get asked on OTN a lot".
With ADF it is very easy to drag an operation to a page to create a button that activate it.
But what if you want a single button to invoke two operations? For example have a button that does a "Delete" as well as a "Commit".

The way to do it is to add an action binding, and then overwrite the button function in a backing bean to call the additional action.

The nice thing is that JDeveloper will create all the binding code for you in the backing bean - all you need to do is duplicate it.

Here is a quick demo:

Friday Jul 31, 2009

Java Class Data Control and ADF Binding Tricks Demo

This demo started from a simple request on the OTN forum asking how would you go about creating a JSF page that reads and writes a file content.

The quick answer I gave was that you can do this with a simple Java class that you expose as a datacontrol. But then I started thinking there will be some more tricky parts that you'll need to do in order to get the UI and binding to work exactly as you would like. The trick is to merge the result of one operation to be the input for the other operation. I played around with the solution I provided and decided to record this since there are a few steps here that will be useful to refer people to in the future.

The "Tricky Parts" that demo shows are:
1. Creating a data control from a simple Java class
2. Binding with ADF Parameter Form to invoke methods
3. Setting the value for method's parameters using the binding tab
4. Creating a backing bean for a JSF page
5. Modifying a default ADF method in a backing bean
5. Accessing an ADF binding control value in your backing bean
6. Binding an existing JSF components to a backing bean
7. Deleting a component from a JSF page without deleting it's binding

Here is the demo:

I hope this helps.
(And sorry that I got a phone call and an IM while recording :-) )

Note - some people requested to see the actual code - you can find the completed workspace here.

Friday Jan 09, 2009

Preventing Queries When Page First Loads

When you are dealing with big sets of data or complex queries you sometime want to prevent the automatic execution of a query that happens when you bind a table or form in an ADF page to a data control.
Common example is if you have a VO query that depends on a parameter and you have a single page where you let people insert the parameter (using executeWithParams for example) and see the data below it in a table.
The first time you run the page you don't want the table to be populated.
(This is quite a common question on the OTN discussion forum also).

The solution is to have a condition associated with the refresh condition of the iterator that displays the data in your page.
In the ADF Developer Guide for 10.1.3 it is explained under: Controlling Whether Data Appears Initially
And the achieve it by using the ${adfFacesContext.postback == true} expression.

In 11 there is a new variable that does the same it's name is adfFacesContext.initialRender and the EL you would use would be: #{!adfFacesContext.initialRender}

To try it out take the VO based on Departments and drop it on your page as a form - now run the page and you'll see data.
Now go into the binding editor and fill out the value #{!adfFacesContext.initialRender} for the iterator.
binding001.gif

If you run the page again, the Form would be empty.

Note - in some cases this solution is not enough - a safer bet would be to use a condition that checks if the parameter that you need to pass to the method is empty - see the blog entry - Delay Method Execution When Using ADF Binding

 

 

About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today