Monday 25 February 2013

Code to find an UI Component in an Oracle ADF Application

## Find an UI Component in the page

Hello all,
There are cases where you have to find a component on Page by id in the bean. Here is the method.


private UIComponent findComponentOnPage(String id){    
    String comp = id;
   //see ADF Code Corner sample #58 to read about the code
//used in the search below
FacesContext fctx = FacesContext.getCurrentInstance();
UIViewRoot root = fctx.getViewRoot();            
   root.invokeOnComponent(fctx,comp,
new ContextCallback(){
      public void invokeContextCallback(FacesContext facesContext,UIComponent uiComponent) {
       lookupComponent = uiComponent;
     }         
  });
return lookupComponent;
}

No comments:

Post a Comment