aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes findAncestorWithClass Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "findAncestorWithClass" Watch "findAncestorWithClass" New topic
Author

findAncestorWithClass

shanthisri mocherla
Ranch Hand

Joined: Sep 05, 2005
Posts: 119
Hello ranchers

I'm having some trouble with the findAncestorWithClass(tag,class) method.

I've a question??
It returns an instance of the class we are passing as the argument to the method right??


So if I have two tags one nested inside the other i.e one parent tag and one child tag.

Then can i get the name of the parent tag by using this method??

<mine:Menu>
<mine:MenuItem/>
</mine:MenuItem>


Thanks for helping me
Shanthi
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

I've a question??
It returns an instance of the class we are passing as the argument to the method right??


Correct


So if I have two tags one nested inside the other i.e one parent tag and one child tag.
Then can i get the name of the parent tag by using this method??


Yes you can.

NOTE:
findAncestorWithClass(tag,class) is generally used to get the top-level instance skiping some levels. So if you looking for a immediate parent you can use getParent() method.


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: findAncestorWithClass
 
Similar Threads
findAncestorWithClass and getParent
How to get a SimpleTag Parent inside Classic nested Tag ( have a look)
findAncestorWithClass() Versus getAdaptee()
Custom tags: how to get the number of "child" tags
method findAncestorWithClass