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
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 ]
Author of German LDAP-Book
Committer at Apache Directory Project