Padhu Vinirs wrote:
Tomcat 4.1.12

I have a custom tag that I derive from BodyTagSupport. In doAfterBody I
print out to the bodyContent's enclosingwriter object. The output
appears only if the actual body content is present. Else, looks like
doAfterBody is not even called ( even when I override doStartTag and
return EVAL_BODY_BUFFERED ).

<test:details/>    ==>  doAfterBody does not print out anything.
<test:details>...</test:details>   ==> Everything works as expected.

I dont get any exceptions in the log files.

Any suggestions.
This is exactly as it should work according to the spec, see
JSP 1.2, section "JSP.10.2.2.12 Methods" for instance. None of the
following methods are invoked for an empty tag:

  doInitBody()
  setBodyContent()
  doAfterBody()

The spec is not as clear as it should be, but this is the intention
even though some containers may have it wrong. If you want things
the happen no matter if the body is empty of not, code it in the
doStartTag() or doEndTag() methods.

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com

Reply via email to