doEndTag() returns an indication of whether you are done with this page
(e.g. because you just forwarded the request elsewhere, or whatever), or
not.  (EVAL_PAGE and SKIP_PAGE).  It should also release all local
resources.

release() is intended to release resources not defined locally in this
class and it should maintain invariants.  release() is provided because
that way it can be inherited from a superclass and most Tag handlers
need not do anything about that at all.  It is symetric to the
initialize() method.  Initialize is easier to argue: initialize
maintains one (perhaps later more) global invariant: the parent link,
which can be used by a nested tag.  I felt uncomfortable letting a
quick-and-dirty Tag handler manage this invariant as failure to do it
correctly would lead to tags that used to work stop doing so.  Some
people have accused me of being paranoid on this one.

Hope this helps,
        - eduard/o

David Navas wrote:
>
> Just fyi -- I think that was fairly clear, its just that the
> implementation I was using lost content and I wanted to make sure I was
> doing things correctly.  :)
>
> By the way, I'm not sure what the doEndTag() exists for.  Are there places
> where it should be called and release() should/might not?
>
> -Dave
>
> Eduardo Pelegri-Llopart wrote:
> >
> > Dave Navas asked:
> >
> > =========
> > A quick btw -- if someone can 'splain to me how this kind of tag:
> >     <setPageData>  <myCustomTag/>  </setPageData>
> > can capture its body, I'd sure appreciate it.  Maybe it's just the
> > engine I'm
> > using, but I'm not clear as to how that's accomplished.  It seems like
> > all I
> > have is a writer.  I can probably get the contents out of it, but how do
> > I
> > prevent the output from ending up on the page?
> > ==========
> >
> > In the JSP 1.1 PR1, you (your tag handler) has to first indicate it is
> > interested in handling the body.  It does that by returning EVAL_BODY
> > from the doStartTag() method.  The JSP page implementation class will
> > then create a BodyJspWriter object and will pass it to the Tag class.
> > Then the methods doBeforeBody() will be evaluated; the BODY will be
> > evaluated into this new object, and finally doAfterBody() will be
> > evaluated [[in some cases the doBeforeBody() will be a noop]].  A
> > typical example will at this point take the BodyJspWriter (that got
> > passed in before) and extract from it whatever information it wants
> > (that is why it is a BodyJspWriter, not a plain JspWriter).  If you want
> > to reevaluate the body (say because something somewhere has changed),
> > just have doAfterBody() return EVAL_BODY; if not, make it return
> > SKIP_BODY.
> >
> > Hope this helps.
> >
> >     - eduard/o

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to