public static UIComponent findBsfComponent ( UIComponent parent , String targetLib ) { if ( targetLib . equalsIgnoreCase ( ( String ) parent . getAttributes ( ) . get ( "library" ) ) ) { return parent ; } Iterator < UIComponent > kids = parent . getFacetsAndChildren ( ) ; while ( kids . hasNext ( ) ) { UIComponent found = findBsfComponent ( kids . next ( ) , targetLib ) ; if ( found != null ) { return found ; } } return null ; }
Check all components in page to find one that has as resource library the target library . I use this method to check existence of a BsF component because at this level the getComponentResource returns always null