How to refresh page in Oracle ADF by using method

There are many scenarios when we have to refresh the Page by clicking on any Button or using Action Listener. We can achieve this functionality by using this code in the ADF Managed Bean.

  Step 1-

Add this given method in the bean and import the relvent methods

  private void refreshPage() {
        FacesContext fctx = FacesContext.getCurrentInstance();
        String page = fctx.getViewRoot().getViewId();
        ViewHandler ViewH = fctx.getApplication().getViewHandler();
        UIViewRoot UIV = ViewH.createView(fctx, page);

 Step 2-

After writting the method we have invoke that particular method in Acton Listner or wherevere we want.

    public void buttonAL(ActionEvent actionEvent) {