tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <j...@socialchange.net.au>
Subject Re: Jasper Bug 652 (do*Body not called): not a bug?
Date Thu, 18 Jan 2001 23:11:36 GMT
Hi Rickard,

I've cc'ed the taglibs-user list, as if you're right then there's a bug in 
the utilities taglib, and Tomcat. If I'm right then it's just JRun3 that's 
buggy.

> Jeff Turner wrote:
> > Having a look through bug 652:
> >
> >  BodyTag doInitBody and doAfterBody called on tags without body
> >
> > (http://znutar.cortexity.com/BugRatViewer/ShowReport/652)
> >
> > I don't think this is a bug.
> >
> > The JSP spec, p88, says:
> >
> > "If an action element can have a non-empty body and is
> > interested in the content of that body, the methods doInitBody() and
> > doAfterBody(), defined in the BodyTag interface are involved."
>
> My interpretation of this is:
> * Tag "foo" may have body
> * <x:foo>Blah</x:foo> -> body methods called
> * <x:foo/> -> no body methods called

This looks like the crux of the issue. Do you agree that according to the XML 
spec (http://www.w3.org/TR/2000/REC-xml-20001006#sec-starttags), 
<x:foo></x:foo> and <x:foo/> are exactly equivalent? 

Here is the spec's definition of an empty element:

[Definition:] If an element is empty, it must be represented either by a 
start-tag immediately followed by an end-tag or by an empty-element tag.

Further, here's Tim Bray's comment from the annotated XML spec 
(http://www.xml.com/axml/target.html#sec-starttags):

"So, is this: <img src='madonna.gif'></img> really exactly the same as <img

src='madonna.gif'/>? As far as XML is concerned, they are."

So, if they mean exactly the same thing, why should the JSP engine 
discriminate in which methods it calls? Below, you agree that with 
<x:foo></x:foo>, the doBody() methods should be called. Since <x:foo/> means

exactly the same thing, for consistency the JSP engine should also call the 
doBody() methods.

> > Note, "can have", not "if it does have". So an element without a body,
> > but that *could* have a body according to the TLD, still has do*Body
> > methods called.
>
> ... if it has a body *in the usage of it*, sure. Of course. But if it's
> not *used* with a body, then the body methods should not be called.

Nowhere does it say "in the usage of it". It says "if an action element can 
have a non-empty body". Now, the TLD declares that x:foo *can have* a 
non-empty body if it wants to. In the usages <x:foo></x:foo> and <x:foo/>,
it 
just happens not to.

> > So:
> >  <my:tag>foo</my:tag> has do*Body() called (obviously).
> >  <my:tag></my:tag> has do*Body() called (the body will just be blank)
> >  <my:tag/> has do*Body() called, because according to the XML spec,
> > this is shorthand for the <my:tag></my:tag> notation, and therefore
> > processes equivalently.
>
> I see the two last ones as distinctly different, whereas the first two
> are identical semantically. And I have a couple of tags that indeed
> makes a major difference between <x:foo></x:foo> and <x:foo/>.
>
> > Interestingly, JRun3.0 has the opposite bug, and doesn't call
> > setBodyContent if the tag doesn't have a body but could.
>
> To me that is correct.
>
> > Eg, in JRun the following action breaks:
> >
> > <util:include url="foo.html"/>
>
> Why? How is this tag dependent on a body to be supplied?

Um :) It does seem a bit pointless in the util taglib's case. I'll cc the 
> Why? How is this tag dependent on a body to be supplied?

Um :) It does seem a bit pointless in the util taglib's case.

> > But this works:
> >
> > <util:include url="foo.html"></util:include>
> >
> > The taglib in question is from the Jakarta Taglibs project.
>taglibs list. 

> > But this works:
> >
> > <util:include url="foo.html"></util:include>
> >
> > The taglib in question is from the Jakarta Taglibs project.
>
> To me this hints at a bug in the Jakarta Taglibs.
>
> It might be beneficial to send a query about this to the JSP spec
> writers, since it's a rather important issue. I have CC'ed
> jsp-spec-comments@eng.sun.com.

Thanks.

--Jeff


>
> regards,
>   Rickard
>
> --
> Rickard Öberg
>
> Email: rickard@jboss.org

Mime
View raw message