Resending; the first message seems to have been lost -- JonTom
______________________________
I have been observing behavior that I assumed was a bug in JRun. When I
have a custom tag that has a <jsp:include> in its body, the included
content is displayed *before* the custom tag. This happens even with a
custom tag as minimal as the FooTag.java included with the Tomcat
examples.
For instance, if my JSP looks like this:
<ul>
<eg:foo att1="red" att2="blue" att3="green">
<li><%= member %>: <jsp:include page="bar.jsp" /></li>
</eg:foo>
</ul>
The output looks like this:
Included content
Included content
Included content
red:
blue:
green:
I was looking at the spec to make sure I had this all right for my bug
report to JRun when I came across this paragraph (JSP 1.1 spec, Section
5.4.5:
It is not possible to invoke flush on a BodyContent object, as
there is
no backing stream. This means that it is not legal to do a
jsp:include when out is not
bound to the top-level JspWriter.
Does this mean what it appears to mean!?! Does this mean that there can
be no included content in the body of a custom tag that returns
*anything* other than EVAL_BODY_INCLUDE? Does that mean that there can
be no jsp:include in, say, a simple iterator tag?!? That's what it seems
to me, since Section 5.4.2 says:
EVAL_BODY_TAG means create a new BodyContent, change the value
of the out
implicit object and process the body of the action.
And since Section 5.4.4 says
A tag handler that implements BodyTag is treated as one that
implements Tag, except that
the doStartTag method can either return SKIP_BODY or
EVAL_BODY_TAG, not
EVAL_BODY_INCLUDE.
How can one implement a tag that does flow control without implementing
BodyTag and having access to doInitBody() and doAfterBody()?
To quote another part of the spec "Including data is a significant part
of the tasks in a JSP page." It is indeed! I can tell you flatly that
unless I can call <jsp:include> in a flow-of-control tag, there's no way
I can use JSP for my projects, no matter how much time I have already
invested it. It's as simple as that.
If I have misinterpreted the spec, I would be delighted to hear it, but
please let me know how. As it is, I don't see how they could be read in
any other way.
Yours, JonTom
JT Kittredge
ITA Software
Cambridge, Massachusetts
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets