I am totally clueless and desperate at this moment. As someone usually working at the backend service, I am working on a project that uses a custom tag in a JSP file. Here is the tag descriptor
Here is the Tag handler
And here is the JSP fragment that uses the custom tag
Everything seems working fine except that the custom tag handler does not get called at call. I set breakpoint and it never stops there. The JSP page is displayed fine, only not showing the custom tag content :(
and there is no logged error/warning from the log. The tld is found fine. Can someone please give me some hint/helps on how to troubleshoot this? Like what classes called/validated the tag handler so I can logging those classes at DEBUG level to see what goes wrong. Any helps would be deeply appreciate it. It is so frustrating
Thanks a lot
This doesn't seem right. You shouldn't need to implement the Tag interface. Extend the TagSupport class instead.
This doesn't look right either. A classic tag inherits the pageContext member variable from the TagSupport class. I think you are missing this because of the interface implementation you had above. Extend TagSupport and change this line to
(Still recommend porting to SimpleTag)
Note that this file MUST be /WEB-INF/ or /WEB-INF/tags/ or a folder below that. Make sure your tld file is in /META-INF/TLDS. I suspect you have your tld in the same folder as your URI, namely here:
That won't work. Remember, that URI is not a location, it's just a unique identifier for namespacing purposes. It could just as easily be "123ABC" as long as it matches what's in the tld file.
Bear Bibeault wrote:My recommendation is to always use URIs that follow the proper format that look like URLs. That way, no one is fooled into thinking it is a file path. (Of course, then some people think that they are URLs rather than URIs, so I guess you can't win.)
That's always been an area of confusion. My point was that if he's put the tld file under WEB-INF the container won't find it. It has to be under META-INF. Tag files go under WEB-INF. More confusion. I suspect that's why the code isn't running; the container just can't find the files in the expected locations.
Bear Bibeault wrote:Actually, the container will find tlds under WEB-INF in a web app. But only if the URI is proper and matching. If the tag library is jarred, that's when META-INF comes into play.
I told you I'm having trouble with that chapter<sigh>. You are absolutely correct.
I'm running out of ideas, so let's back up and start from square one. gigi, please post the latest version of your tag handler, the tld, and the jsp, and I'll create a project and try to duplicate the problem.