Refreshing the page by java mehtod in Oracle ADF

In Oracle ADF, for refreshing the page after doing some operation in database we need to refresh the Page ,which is very needed to display the right content.For this we need to write java method in page.java file. Write that method anywhere in java file and call that method anywhere where you want to refresh the page.

protected void refreshPage() {
      FacesContext fc = FacesContext.getCurrentInstance();
      String refreshpage = fc.getViewRoot().getViewId();
 ViewHandler ViewH =                                                                                                                   
 fc.getApplication().getViewHandler();
      UIViewRoot UIV = ViewH.createView(fc refreshpage);
      UIV.setViewId(refreshpage);
      fc.setViewRoot(UIV);
}

This is only method you need to write to refresh the page.

Executing the view object query in Oracle ADF

In oracle ADF, for executing the view object query we need to write code for that.This code is needed for refreshing the table content after executing some DML operation.For that we need to execute the query of view object.For that write an in application module Impl.java file.For an example look the below code-

 


    public void refreshVinayView()
    {
VinayViewObject  vinay= get VinayViewObject 1();
        vinay.executeQuery();
    }

After writing in AppmoduleImpl.java file.save your application and double click on app module.Go to client interface and shuttle right to this method “refreshVinayView” .
After that From where you what to execute the view object query.For example- we are deleting some row from table and want to reexecute the query again then we can write the code in specific java file of some .jspx file.Sample code is as below.

   FacesContext fctx = FacesContext.getCurrentInstance();
        ValueBinding vb = 
            fctx.getApplication().createValueBinding("#{bindings}");
        DCBindingContainer dcb = (DCBindingContainer)vb.getValue(fctx);
        OperationBinding operation = 
            (OperationBinding)dcb.get("refreshVinayView ");
        operation1.execute();

One more thing needed.Go to page definition of that specific .jspx file. And in Binding tab in structure window.Right click the binding tab and go to method action.An “Action binding editor” window will open.Select your java method in SELECT AN ACTION drop down and press ok.

This is all you need to execute the view object the query.

Hello World Tutorial in ADF

This tutorial will explain creating new application, new pages, and navigation cases. It will display
Explain you event generated on a command button .It will be redirected to new page(.jspx) and display a message. I hope it will clear the basic understanding navigation and business component.

1. Open Jdeveloper and right click on project and select new. Under Web tier tab select JSF.

11

2. A create JSF and JSP wizard will open and give name to your .jspx page press next. Here we can select JSF(.jspx) and JSP page.

2

3. Click next and add ADF libraries. And select finish.

3

4. A blank Test2.jspx will open.

4

5. In WEB-INF folder under web content open face-config.xml .Drag and drop 2 JSF page to face- config file .Give name test2 and test3.jspx.Then drag and drop the “JSF NAVIGATION CASE” and place it from test2.jspx to test3.jspx .Replace success to navigation in JSF NAVIGATION CASE. For generating the PopUp window we can write this as “-dialog:naviagtion”. Make user window property to true and test3,jspx will displayed as popup page.

5

6. Save your application and go to test2.jspx .Drag and drop one command button on page and rename to “Next page” from property palette under text property. In action property select
“navigation “ .It will redirect to test3.jspx .

6

7. In the face-config.xml file double click on test3.jspx. Create JSF JSP wizard will open. Click next and press finish.

8. Drag and drop one outputText from component palette on test3.jspx.Change the value property of outputText to “Hello World”.

7<img

9. Save your application and run the application.Test2.jspx will open.

8<img

10. Click on next page.Test3.jspx will open and “HELLO WORLD ” will displayed.

9

This is all about this hello world application. Later I will explain about more complex issues in ADF. Please review this and give your valuable comments.