Forums Register Login

Custom tags Qn in K &B pg 560

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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...
+Pie Number of slices to send: Send
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()

 
+Pie Number of slices to send: Send
Please any one explain this in detail...

Regards,
krishna.
+Pie Number of slices to send: Send
 

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.
You had your fun. Now it's time to go to jail. Thanks for your help tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 733 times.
Similar Threads
SimpleTags + ClassicTags + getParent()
Doubt on Tag Handlers
Simple/Classic tag parent access
Doubt on Q 3 HFSJ chapter 10
HF chap.10 : don't understand answer for Q3
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:02:52.