• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom tags Qn in K &B pg 560

 
vandu matcha
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given a Jsp Page:
<my:tag1>
<my:tag2>
<my:tag3/>
<my:tag2>
<my:tag1>
TagHandler for tag1 extends TagSupport; tag2 -SimpleTagSupport; tag3 extends TagSupport

Answer given C ..
my doubt is custom tags cannot have a simple tag as a parent so how can tag3 get access to the tag1;
pls clarify...am i missing something??
or is it in the errata..i dont have any
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I do not have my book available right now. If you need a link to the errata we have one at the bottom of our ScwcdFaq!
 
vandu matcha
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi marc..
thanks for the errata..but its not there in the errata...
ok..i will give the options for the above Qn..

A. Tag3Handler cannot access the instance of Tag1Handler because Simple tags donot support access to the tag parent.

B. Only Classic tags are considered in composing the parent/child tag hierarchy; therefore, Tag3Handler may use the getParent method only once to gain access to the instance of Tag1Handler

C. Tag3Handler may use the getParent method twice to gain access to the instance of Tag1Handler.

D.Only Body Tag handlers can access the parent/child tag hierarchy; therefore, Tag3Handler cannot gain access to the instance of Tag1Handler.


Ans given is C but i think it is A.
ofcourse simple tags can have custom/simple tags as parents but
custom tags cannot have simple parents..hence tag3 cannot gain access to tag2...
 
Cai DongShan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, vandu,
custom tags cannot have simple parents..hence tag3 cannot gain access to tag2..


No, it is wrong. Please refer to HFSJ p540.

Classic tags can have Simple parents, but it takes a slight hack to make that work because you can't cast a SimpleTag to the Tag return value of the Tag interface getParent()
 
Krishna Latha Grandhi
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please any one explain this in detail...

Regards,
krishna.
 
Leigh Su
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vandu matcha:
am i missing something??
or is it in the errata..i dont have any


Hi, Vandu

Actually, there is explaination within HFSJ errata:
[550] question 3;
Option C is invalid.
Unfortunately, that leaves us with a mock question that doesn't have a valid answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic