19 August, 2012

ADF Faces : Get Child Component

You can use the code snippet for finding child component under parent component  in ADF Faces.

   public static FacesContext getFacesContext() {  
     return FacesContext.getCurrentInstance();  
   }  
   
   public static UIComponent getChildUIComponent(String ParentUI, String ChildUI) {  
     UIComponent parentUI = getFacesContext().getViewRoot().findComponent(ParentUI);  
     UIComponent childUI = null;  
     UIComponent tempUI = null;  
   
     Iterator childrens = parentUI.getFacetsAndChildren();  
     while (childrens.hasNext()) {  
       tempUI = (UIComponent)childrens.next();  
       if (ChildUI.equals(tempUI.getId())) {  
         childUI = tempUI;  
         break;  
       }  
     }  
     return childUI;  
   }  

Import the following Classes

 import javax.faces.component.UIComponent;  
 import javax.faces.context.FacesContext;  

Thanks

1 comment:

ADF : Scope Variables

Oracle ADF uses many variables and each variable has a scope. There are five scopes in ADF (Application, Request, Session, View and PageFl...