Class TaglibUtils

    • Method Detail

      • findAncestorWithType

        public static <T> T findAncestorWithType​(javax.servlet.jsp.tagext.Tag from,
                                                 Class<T> type)
        Finds an ancestor tag of the given type. Starting from the given Tag, it traverses up the parent tags until a tag of the given type is found.

        Use this method instead of TagSupport.findAncestorWithClass(Tag, Class), as it is aware of proxied tag classes, while findAncestorWithClass only sees the proxy instances instead of the tag classes behind it. Furthermore, this method is also able to locate interfaces.

        Type Parameters:
        T - Type to find and return
        Parameters:
        from - Tag to start from
        type - Type to find
        Returns:
        Ancestor of that type, or null if none was found.