code: 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;
  	}
docs: 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
  
  @param parent    the parent component
  @param targetLib the lib to search
  @return