Thursday, 3 February 2011

Stop Execution Of View Object at First Load of Page

This can be done in many ways.

I am going through one simple way without creating managed bean or using task flow.

First Create the Fusion Web Application.
Then create the ADF Business Components to create Entity Object, View Object and Application Module in  Model project



Now create the page to show the table data. 


Now if you run the page you will see that the VO is executed on First Page Load and it is showing data in table.

To stop that first create the <VOName>ViewObjectImpl class for me it is EmployeesViewObjectImpl.java

in this class override the method


    protected void executeQueryForCollection(Object object, Object[] object2, int i)


use the below code to override.


       @Override
    protected void executeQueryForCollection(Object object, Object[] object2,
                                             int i) {

        if (counter > 0) {
            super.executeQueryForCollection(object, object2, i);
        } else {
            counter = counter + 1;

        }
    }








Now if you run the page you will not be able to see the data. On Execute Button Click the data can be shown.







For further queries you can add comment on this blog.



4 comments:

  1. Hi Sau,
    Can you tell me where and how did you created the variable 'counter'?

    Thanks,
    Sandy

    ReplyDelete
  2. Thanx so much . It solved my problem :-)

    ReplyDelete
  3. Hi

    Can you tell me where and how did you created the variable 'counter'?

    Thanks

    ReplyDelete
  4. The variable 'counter' is created as a global variable in the VOImpl class.

    ReplyDelete