I have written a JSP custom tag, implemented in a class that extends TagSupport, and I’d like to invoke another custom tag that was written as a *.tag file. Is this possible? If so, how can it be done?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t, tag files can only be executed from a JSP.
Even executing one tag class from another is questionable, you’re not supposed to do that either (although it would probably work).
If you need reusable logic that gets invoked from your tag class, then you either need to extract it out into a common class, or else you need to make your custom tag into a
BodyTag, and put the .tag file in as nested content withoin it, e.g. iftagXis a taglib, andtagYis a tag file, then:The output content of
<mytags:tagY/>would then be exposed to thetagXcode via theBodyTaginterface.