public static UIComponent addTransient(
      FacesContext context, ServletRequest req, UIComponent parent, String prevId, Class childClass)
      throws Exception {
    if (context == null) context = FacesContext.getCurrentInstance();

    if (parent == null) {
      UIComponentClassicTagBase parentTag =
          (UIComponentClassicTagBase) req.getAttribute("caucho.jsf.parent");

      parent = parentTag.getComponentInstance();

      BodyContent body = parentTag.getBodyContent();

      if (body != null) addVerbatim(parent, body);
    }

    UIComponent child = null;
    ;

    if (child == null) child = (UIComponent) childClass.newInstance();

    child.setTransient(true);

    addChild(parent, prevId, child);

    return child;
  }