This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I just tried to execute the example(Menu and MenuItem tag handlers) given on the page 543 in HFSJ first editon.
There two tag handlers are given:Menu and MenuItem.. But how to define these tag handlers in Tag Library Descriptor..Should i use seperate TLD for seperate tag handlers or only in one file should i give the both tag handlers..
Any link which provides how to deal with multiple tag handlers is of great help as these things are not explained in HFSJ
I think the general convention is one tld file per-prefix. So say you define multiple tags specifically for menus then you would have one menu.tld and within it you would have definition for say mainMenu tag and subMenu tag and the usage in the jsp would be like menu:mainMenu or menu:subMenu. If your application is not that big then you can have just a single tld file which would define all the custom tags in your application.
He who asks a question is a fool for five minutes; he who does not ask a question remains a fool forever - Chinese proverb
Should i use seperate TLD for seperate tag handlers or only in one file should i give the both tag handlers..
You can do both. If you use different TLDs, you'll also have to use different prefixes in your JSP. If you use only one TLD, yoう can use multiple <tag> tags in it. [ July 09, 2008: Message edited by: Christophe Verre ]
With the parent's body content set to "tagdependent", I don't think that the inner tags will be evaluated. But there's a bigger problem : Menu's doEndTag is not spelled properly. doEndtag -> doEndTag [ July 10, 2008: Message edited by: Christophe Verre ]