Showing posts with label refresh. Show all posts
Showing posts with label refresh. Show all posts

Friday, July 29, 2011

ADF page refresh using java code


This post will show the code for a full page refresh. Most of the time Partial page rendering do the work, still we need a full page refresh. For this easy way is to call a java method and refresh the page. This is needed when there is a change in database values and you want to refresh the form and table after operation. 

So use following code for this:
public void refresh() {
      FacesContext facesContext = FacesContext.getCurrentInstance();
      String refreshpage = facesContext.getViewRoot().getViewId();
 ViewHandler  viewHandler =
facesContext.getApplication().getViewHandler();
      UIViewRoot viewroot =  viewHandler.createView( facesContext, refreshpage);
viewroot.setViewId(refreshpage);
facesContext.setViewRoot(viewroot);
}