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