IntelliJ Java IDE
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Section 12.8 of Objectives - Nested TagHandlers? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "Section 12.8 of Objectives - Nested TagHandlers?" Watch "Section 12.8 of Objectives - Nested TagHandlers?" New topic
Author

Section 12.8 of Objectives - Nested TagHandlers?

Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
12.8 Identify methods that return an outer Tag Handler from within an inner tag handler.
Ans: (from Michell's notes)
Tag.getParent( ).
TagSupport.getParent( ) (same as above)
TagSupport.findAncestorWithClass(someClass)
Can someone give me a practical scenario where I would use these methods ?
Thanks.
- satya
ps:
Source code would be great, but I don't want to get too greedy. Thoughts, ideas are equally appreciated.


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Stefan Zoerner
Author
Ranch Hand

Joined: Nov 29, 2001
Posts: 121
Hi!
"Core Servlets and JavaServer Pages" by Marty Hall contains a nice example (Chapter 14, Creating Custom JSP TagLibs).
It describes a set of tags that would be used like that:

The implmentation of the condition-, the then- and the else-tag use findAncesteorWithClass to navigate to the surrounding if-tag. The condition-tag sets a boolean-value on that if-tag, the other two are evaluated or not, depending on that value.
You can download the sourcecode of the example at
Book's Website
I hope that is what you are looking for.
Greetings from Hamburg,
Stefan
[ January 18, 2002: Message edited by: Stefan Zoerner ]

Stefan Zoerner
Author of German LDAP-Book
Committer at Apache Directory Project
 
 
subject: Section 12.8 of Objectives - Nested TagHandlers?
 
Threads others viewed
about the exam objective
Accessing webapp context parameters from a custom tag handler
New forum for Sun Certified Web Component Developer
Custom Tag Query
last SCWCD question
developer file tools