File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Nesting betn Simple Tag and Classic Tag 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 "Nesting betn Simple Tag and Classic Tag" Watch "Nesting betn Simple Tag and Classic Tag" New topic

Nesting betn Simple Tag and Classic Tag

Tridib Samanta
Ranch Hand

Joined: Apr 28, 2004
Posts: 128
Hi All,
I really confused about the nesting between classic and simple tag. My original idea was
1. We can nest both simple and classic tag inside classic tag.
2. We can nest only simple tag inside a simple tag.
3. If we need to nest a classic tag inside a simple tag we to write adapter class.

But for the exam we only need to know point 1 & 2.

Am I correct?

Guys any help in this topic will be of great help. I not good in nested tags.

Thanks, Tridib
SCJP 1.4, SCWCD 1.4, SCBCD 5.0
Sri Kan
Ranch Hand

Joined: Feb 20, 2007
Posts: 30
We can nest simple tag in classic tag and vice versa is also correct.

When you need share data between classic tags and simple tags adapter comes into picture. I suggest you to try few examples on this topic.

I got one question in exam on this topic. Question and options) filled more than half of the screen

Cheers,<br /> <br />SCJP 1.5 (83% Huh !)<br />SCWCD 1.4 (81% that's it ??)
Francisco Neto

Joined: Mar 29, 2007
Posts: 25
I think the point is

As said before, you can nest both Simple and Classic tags. But when using a Classic tag inside a Simple tag you cannot retrive this last one by using the getParent method because it will retrieve a object of type Tag. Therefore, if you use a simple tag inside a classic tag when you try to retrive the parent tag by using the same method (but now of the simple tag object) you will get a object of JspTag interface. This way you could do a cast and get a classic tag.


1 - You can retrieve a classic tag from a simple tag by using the getParent method on this object.

2 - You cannot get a simple tag from a classic by using the getParent method on this object.
I agree. Here's the link:
subject: Nesting betn Simple Tag and Classic Tag
It's not a secret anymore!