Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Section 12.8 of Objectives - Nested TagHandlers?

 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
    Bookmark Topic Watch Topic
  • New Topic