Search This Blog

Friday, August 10, 2012

Refresh ADF page programmatically.

Several times, we might have the need to refresh the page programatically. Every page is internally given an ID and can be refreshed by this ID as follows in the backing bean.

Refresh a page programmatically.

String refreshPage = fctx.getViewRoot().getViewId();
ViewHandler vh = fctx.getApplication().getViewHandler();
UIViewRoot UVi = vh.createView(fctx,refreshPage);
UVi.setViewId(refreshPage);
fctx.setViewRoot(UVi);

7 comments:

  1. How to implement backing bean in ADF?

    ReplyDelete
    Replies
    1. There are multiple ways to implement backing bean.
      1. While creating a page, user is given the option of creating a backing bean/managed bean.
      2. Double click on any of the input values in the design tab, user is prompted whether to create a managed bean.
      3. Right click on the page in design mode and select create method binding, which pops up a window showing already created managed beans, if you intend to create a new one, click on the new button.

      Note : Creating at page creation vs creating based on a specific requirement on the page has its own advantages and disadvantages.

      Hope this helps.

      Delete
  2. There is an option provided while creating EO or VO to select checkbox if backing bean needs to be created.

    ReplyDelete
    Replies
    1. Balu we dont have the option of creating backingbean while creating a EO or VO. EO or VO are part of ur model layer. Where as Backing bean is part of ur view layer (associated with UI).

      Typically, backing bean or managed bean can be created while creating a page (jspx), under page implementation section.

      Delete
  3. My page renders based on a request parameter passed in:
    e.g.
    actionTypeCode = req.getParameter("action_type_code");
    then execute the VO with where clause based on actionTypeCode

    So how can I refresh the page and pass in "action_type_code" using the above codes?

    ReplyDelete
  4. Hi Mina,

    A simple solution is to get an handle to the VO iterator, set ur where clause and re-execute the iterator.

    Since VO iterators are coming from page defn, u dont need to explicitly refresh the page.

    Here is a sample, hope it helps.

    DCIteratorBinding orderVOIter =
    (DCIteratorBinding)bindings.get("OrdersVOIterator");

    String actionTypeCode = req.getParameter("action_type_code");

    orderVOIter.getViewObject().setNamedWhereClauseParam("action",actionTypeCode);

    orderVOIter.getViewObject().executeQuery();

    ReplyDelete
  5. The King Casino - Herzaman in the Aztec City
    The King Casino in Aztec City is the place where https://vannienailor4166blog.blogspot.com/ you can find and play herzamanindir.com/ for https://septcasino.com/review/merit-casino/ real, real money. 바카라사이트 Enjoy a memorable septcasino stay at this one-of-a-kind casino

    ReplyDelete