posted 14 years ago
Hi, UdayKumar thanks for your reply. I think doInitBody() will be called after setBodyContent(). As far as I know, if the doStartTag() returns EVAL_BODY_BUFFERED, the container calls the pageContext's pushBody(), and the pushBody() creates BodyContent object,which is sub class of JspWriter(by encapsulating the body of the tag) and will return. Then the container sets the BodyContent via setBodyContent(BodyContent bc), after it will call doInitBody(), then the body is evaluated by the container. The whole above process will be happens when the tag invokes with the body and if the doStartTag() returns EVAL_BODY_BUFFERED.
If the tag is not invoked by body, and if we return EVAL_BODY_BUFFERED, the above process will not happen. It will directly executes doEndTag()(the doEndTag() tag will be execute only if the method returns SKIP_BODY). My question is at what stage, the container knows, that the tag has no body, that's why I (container), have to return SKIP_BODY. Thankyou.
SCJP5.0, SCWCD5.0, OCEJPAD6, OCPJWSD6