Solution for page refresh problems in ADF when no relationships are used.

I have a small program which is used for registering money transfers.

It has two tables, table A holds all the transfer information and table B keeps the total amount of money earned so far. There is no connection between the tables, there are only triggers on table A which keep table B up to date.

On the overview page it looks like this:

The problem that I had was that when I pressed “Create” and inserted a new record, the total amount field was not updated after the create page navigated back to the overview page. It didn’t refresh, but the trigger was called and executed. So, for example, after “2 very large bags of potatoes” was inserted the “Total Amount” field would still display 10, although if you peeked in table B it would say 30.

I don’t know if it’s the right solution, but I solved it this way:

In the page definition of the overview page I made a new action, an execute action based on the iterator of table B.

<action IterBinding=”TotalAmountIterator” id=”ExecuteTotalAmount”
InstanceName=”SampleServiceDataControl.TotalAmount”
DataControl=”SampleServiceDataControl” RequiresUpdateModel=”true”
Action=”2″/>


To invoke it every time the page is loaded, you do this:

<invokeAction Binds=”ExecuteTotalAmount”
id=”ExecuteTotalAmountOnPageLoad”
Refresh=”always”
RefreshCondition=”#{!adfFacesContext.postback}”/>

So far the Total Amount field will always be refreshed when the application navigates to the overview page.

There is only a small exception, the delete button. The effect of pressing the delete button – besides the deletion of the record – is a partial page refresh, so the main table is OK, but the total amount field is not.

I fixed it by calling the method I declared in the page definition in the deleteButton method in the backing bean of the overview page.

public String deleteButton_action() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding(“Delete”);
Object result = operationBinding.execute();

operationBinding = bindings.getOperationBinding(“Commit”);
result = operationBinding.execute();

operationBinding = bindings.getOperationBinding(“ExecuteTotalAmount”);
result = operationBinding.execute();

return null; }

About these ads

4 thoughts on “Solution for page refresh problems in ADF when no relationships are used.

  1. Hi, nice to meet you. I am using the same code as you but don’t really understand it. BindingContainer bindings = getBindings();OperationBinding requery = bindings.getOperationBinding(“xxx”);requery.execute()What is the getBindings() for?What will getOperationBinding(“xxx”)gives me back?Do you have the codes or do you mind explain it to me? Thanks.

  2. Hi,The getBindings() will refer to the bindings that were defined in the PageDefinition file, in other words to the iterators (methodIterator) defined for you specific Data-Object.GetOperationBinding() will look-up the operation-binding defined in your pageDefinition-file. When you’ve looked up the reference you can then programmatically influence the refreshing of your data objects, components.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s