Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Nesting betn Simple Tag and Classic Tag

 
Tridib Samanta
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sri Kan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Francisco Neto
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

i.e.

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic