Hi friends, I tried two handler classes: One implementing TagBodySupport and another TagSupport. code 1
The JSP file including code: <utile:my> <i>Hello</i> </utile:my> With code 1, browser print Hello With code 2, there's an exception like javax.servlet.ServletException: (class: org/apache/jsp/$2_0005f5$jsp, method: _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse V) Incompatible object argument for function call ... Could someone tell me why? Thanks,
TagSupport is for Tags which do NOT manipulate the Body of the tag at all. Therefore none of the methods that are necessary for Body Manipulation are present in this Heirarchy. Tags work mainly by reflection since you return EVAL_BODY_INCLUDE the Container is trying to use reflection to find the methods for doInitBody and they aren't there! If you aren't doing any thing with the body, your doStartTag method should return SKIP_BODY which will prevent the error caused by reflection. If you do need to manipulate the body, subclass BodyTagSupport instead.