Rony RF> If possible I would like to write a single tagclass, but use it RF> for two or more different tags, as the implementation would share RF> quite a lot of code. Besides, it might be helpful for debugging.
CS> Feel free to build a base class with the shared code and then implement CS> the differences in subclasses. Sure, implementing a sub-class of TagSupport that acts as a custom tag super-class works fine. RF> I would have a need to find out the tag name RF> that caused the tagclass to run. RF> RF> Is this possible? If so, how would one be able to get at RF> that tag name (any brief hints would suffice) ? Not sure exactly what you mean... Here's an example: - CustomTagImplementation.java contains: public class CustomTagImplementation extends TagSupport - tags.tld contains: <tag> <name>CustomTag1</name> <tag-class>tags.CustomTagImplementation</tag-class> </tag> <tag> <name>CustomTag2</name> <tag-class>tags.CustomTagImplementation</tag-class> </tag> - page.jsp contains: <td> <tags:CustomTag1 /> </td> Are either of these what you mean? A. Get surrounding tag "<td>" - TagSupport/CustomTagImplementation/getParent(), for calculating something like an xpath? B. Get tag definition name "CustomTag1" - Ouch. Sorry, no help there. How about an intellectual exercise to kill some time? :-) Suppose you had a map of classes and associated tag names from either parsing tags.tld directly or exposing whatever structure holds classes instantiated from it. You might still have a lookup problem due to a one-to-many relationship. Using CustomTagImplementation/getClassName() as the map lookup key would have 2 theoretical answers, both "CustomTag1" and "CustomTag2". By the time the page code is executed, the JSP has aleady been compiled. Looking at pre-compiled org/apache/jsp/page_jsp.java, each call to <tags:CustomTag1 /> gets its own _jspx_meth_* method. There is a comment in each method, "// tags:CustomTag1". Seems kinda messy in there, and potentially fragile to depend on the pre-compiler output format. It's too bad TagSupport is not auto-magically fed as a parameter the name of tag definition in the page that "called" it. All in the engine, no changes to JSP pages. While I have not used it myself, have you looked at SimpleTagSupport to see if it has something useful? -- Cris Berneburg CACI Senior Software Engineer ________________________________ This electronic message contains information from CACI International Inc or subsidiary companies, which may be company sensitive, proprietary, privileged or otherwise protected from disclosure. The information is intended to be used solely by the recipient(s) named above. If you are not an intended recipient, be aware that any review, disclosure, copying, distribution or use of this transmission or its contents is prohibited. If you have received this transmission in error, please notify the sender immediately. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org