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.

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




I am new to this technology and learning. Your tips are very intresting and helpful. Sr

Posted by Shriram on January 31, 2009 at 09:03 AM PST #

Hi, I want to add myself in your weblog but I cannot.Is it possible to permit to login on your web log.I have a question about webservice how can I pass a webservice in adf 11g to a viewobject. Regards

Posted by guest on May 12, 2011 at 12:21 AM PDT #

Guest - you don't need to login to my blog to post comment. As far as asking questions - you should post your questions on the JDeveloper OTN Discussion Forum - and I would suggest you provide there more details if you want people to give you an answer.

Posted by shay on May 12, 2011 at 04:19 AM PDT #


this is not working , still form is showing some data.

Posted by guest on July 19, 2011 at 04:24 PM PDT #

guest - as the video shows it does work :-)
I guess something specific in your scenario is different - if you need help with it try posting on the JDeveloper discussion forum on OTN.

Posted by Shay on July 20, 2011 at 03:33 AM PDT #

This example is only effective in relation to whole pages and
is not applicable for page fragments.

Posted by guest on July 31, 2011 at 04:05 PM PDT #

guest - you might want to use this approach instead for delaying the execution of queries:

Posted by Shay on August 01, 2011 at 04:27 AM PDT #

I am using 11g and calling a web service (created in oracle) having mandatory parameters. I tried using "#{!adfFacesContext.initialRender}" and ${adfFacesContext.postback == true} without success. The web service is still getting called automatically in the background, which I can see in the server log. I also tried giving a 'refresh condition' for the binding like, #{bindings.InputId.inputValue ne null}. But even then I can see that the web service is indeed getting invoked. Any workaround solution to prevent this automatic calling will be helpful. This becomes more critical when calling web services which are not doing the fault handling and hence.

Posted by guest on August 03, 2011 at 03:18 PM PDT #

guest the #{bindings.InputId.inputValue ne null} method should work - note that in some situation you'll need to apply it to multiple iterators in your binding tab. You might want to also see if playing with the refresh property of the binding works. You can also set a breakpoint before the iterator in the binding tab and debug to see what is the value of the EL you use when you hit that point.
If you still can't get it to behave please work with Oracle support that can look into the issue.

Posted by shay on August 04, 2011 at 04:16 AM PDT #

Hi shay, I have exactly same trouble with above guest who called a web service.
the web service is being called although using #{!adfFacesContext.initialRender} or using #{bindings.InputId.inputValue ne null}.

Posted by msjo on February 15, 2012 at 04:43 PM PST #

msjo, this is not something that I can debug over the blog. Try setting up a breakpoint on the iterator and seeing when it is being executed and what are the values of your bindings.InputId.inputValue at that time.

Posted by Shay on February 15, 2012 at 04:47 PM PST #

A note I got from Anand who had the previous issue (Aug 3):
The workaround I found was to create a java proxy class over the web service and inside the method where you are invoking web service, put a small if condition to prevent the Web Service being called in case the parameter is invalid/null etc. Here is my code piece from the proxy class from which I created a data model:

//DS_Id is my input to the web service
public XXDSResponseType callXXDSWS(String DS_Id) {
XXDSRequestType payload = new XXDSRequestType();
XXDSResponseType res_type = new XXDSResponseType();
try {
XXDSABCSImpl_Service = new XXDSABCSImpl_Service();
// Add your code to call the desired methods.
if (StringUtils.isBlank(DS_Id)) {
setError_msg("Please enter DS Id");
else {
res_type = XXDSABCSImpl.process(payload);
// set a custom variable added to display the nessage in UI if required
setError_msg("Web service invoked");

} catch (FaultMessage e) {
// set a custom variable added to display the nessage in UI if required
return res_type;

Hope this info helps.

Posted by Shay on February 16, 2012 at 11:01 AM PST #

Hi shay,
1. The strange thing is that an exception during calling webservice is thrown even though I set the break point before the iterator.
2. Wrapping Java Class is not good solution. Framework should control this requirement.

Posted by guest on February 16, 2012 at 05:33 PM PST #

guest - I'm not sure about the structure of your page flow or your page - but maybe you are running into this:
In any case as I indicated before - it might be better to post this on the OTN discussion forum, or even work this through with Oracle support.

Posted by shay on February 17, 2012 at 09:17 AM PST #

Hello Shay,
I know it is strange but the mentioned approach simply doesn't work for me. I am creating a very simple project and only added are a table and executeWithParams form. Then I tried both #{!adfFacesContext.initialRender} and #{bindings.myInputTextId.inputValue ne null} without success. I am using Oracle IDE Have you got any ideas what might be the problem.

Thanks in advance!

Posted by Todor Kolev on February 19, 2012 at 09:27 AM PST #

i think that the right expression is #{!adfFacesContext.isInitialRender}

no #{!adfFacesContext.initialRender}

Posted by Fazel on February 05, 2013 at 07:00 AM PST #

I agree with guest. I had the same issues with a datacontrol created from a web service. Quick workaround was to back the table and input and command button in a request bean. Set the table Rendered to false. In the backing bean, when command button is clicked, check for null or empty string in the inputtext object. Set table rendered when a value exists, otherwise not. What this does is prevent a call to the web service until a value is entered. It's a kludge, but a quick way to suppress the service call on page load. The other solutions given do not work.

Posted by guest on October 09, 2013 at 10:29 AM PDT #

Hi Shay,

This works only when the underlying VO don't have any name d bind variables.

Is there any way to make it work even with Bind Variables?

Posted by Paul Davis on January 06, 2014 at 02:40 AM PST #

Paul - try the other approach mentioned here:

Posted by Shay on January 06, 2014 at 09:16 AM PST #

To improve on my comment of Oct 9 2013, I found all I need to do for a web service data control causing soap error on initial page load is set the table rendered property as so:

#{bindings.arg0.inputValue ne null}

where arg0.input value is the value you are trying to pass to the web service which on page load is null. No backing bean needed. If table is not rendered, web service is not called. Jdev

Posted by guest on January 27, 2014 at 09:42 AM PST #

this happen when ADF form , not as table

Posted by guest on August 06, 2015 at 04:43 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:

« June 2016