About author  I am Java/oracle professional.Working on Java/J2EE technologies and i.e Java,J2ee,Oracle ADF,hibernate,J2ee,PL/sql,Apps for 4+ years.I am passionate about learning new technologies.I am sharing my knowledge. Give your views and suggestion on vinay@techartifact.com http://www.linkedin.com/in/vinaykumar2 Read more from this author


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.

10 Responses to Refreshing the page by java mehtod in Oracle ADF


  1. HusainNo Gravatar
    May 29, 2009

    Hi Vinay,

    Great Article !
    Cant we also use the refresh attribute of iterator in page definition to do something similar?


  2. vinayNo Gravatar
    May 31, 2009

    yes we can use.But that will work only to refresh the iterator.This method will refresh the whole page.

    Let me know if you have any doubt.


  3. SM ShohidNo Gravatar
    Nov 03, 2009

    Hi Vinay…
    I need auto refreshment with the server data in a whole page in 1 Minute interval.. I m new in Oracle adf.. can u help me regarding this… Thanks in advance..


  4. vijayNo Gravatar
    Jul 27, 2011

    Hi Vinay,

    Its helped me to refresh the page..thanks..


  5. RockyNo Gravatar
    Aug 23, 2011

    Hi Vinay,

    Will this method work for oracle ADF 11g?
    I see that this method was posted in the 2009.

    Thanks


  6. vinayNo Gravatar
    Aug 23, 2011

    it will work


  7. RockyNo Gravatar
    Sep 09, 2011

    Hi Vinay,

    I am new to ADF.

    - I have table, user_items with only one column product_key.
    - I have another table, product_master which has product_key, product_name, description, uom, etc.
    It has about 100000 records.

    I am developing the jspx page where there is a single af:input text field.

    In that textbox, user will enter the product_name textbox and clicks submit the button.

    I need to get the product_key from product_master table and save it to user_items table.

    —-

    I created 2 EOs/VOs. One for each user_items and product_master tables.

    Dragged the user_items datacontrol on the jsp page and made the product_key text as hidden
    Added the new textbox the component palette to enter product_name. Auto suggest feature is not
    a good idea as there 100000 records in that table. So, from the valueChangeListener I want
    to call the bean to get the product_id and assign to hidden input box so that when the
    user clicks submit it will saved in the user_items table automatically.

    Is it possible to do it in the bean like I mentioned above?

    Thanks


  8. vinayNo Gravatar
    Sep 10, 2011

    well i don’t think that this is best way to do.and i am not sure whther it will work or not.create procedure in pl/sql which have one parameter and whose functionality is as to insert record in user_item table.this is best way to do so..

    you just need to pick the value from input text and pass into the parameter of procedure .call the procedure calling method in bean………….


  9. NidhiNo Gravatar
    Sep 29, 2011

    Hi Vinay,

    My use case is to refresh the page when browser is refreshed.
    I want to call this method when browser refresh happens.

    How can I solve this issue?

    Thanks


  10. vinayNo Gravatar
    Sep 29, 2011

    well.. not sure.can you let me know the exact scenario.so that i can help you much better

Leave a Reply