• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Section 12.8 of Objectives - Nested TagHandlers?

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic