Jari,
There's nothing wrong with using endXXX, either way is valid. Using
pushBody() just saves a method. It may also give some finer control, for
instance you could inspect the bodyContent object after each iteration of a
tag. popBody won't write the content out to the endXXX though, for that you
need to use:
bodyContent.writeOut(bodyContent.getEnclosingWriter());
So in a way it's trickier, but if you *don't* need and endXXX method, its a
*little* quicker.
Cheers,
Nick
P.S. I'm jsut impressed with myself that I found this fly trick, it doesn't
mean its actually a good one! :)
-----Original Message-----
From: jariw [mailto:jariw]On Behalf Of Jari Worsley
Sent: Tuesday, August 14, 2001 9:40 AM
To: [EMAIL PROTECTED]
Subject: Re: new com.sun.jsp.compiler.JspReader( ((JspTestCase)this).out
) ?
Nicholas Lesiecki wrote:
>
> Hello,
>
> After much pain the answer comes:
>
> call pageContext.pushBody();
>
> the out object accessible thru pageContext becomes a BodyContent object.
>
> BodyContent is *designed* to let you access the contents.
>
> It's kind of a hack but it works.
I still don't see what is wrong with using the endXX method to test the
content produced by a tag.
If you do it this way by getting a BodyContent, does the output still
get through to the endXXX method, or do you have to do all the tests on
the server side in the testXXX method?
It seems like you should match the pushBody() call with a popBody() at
the end if you want to ensure the content gets written back to the
client.
Jari
--
Jari Worsley
Senior Programmer
Hyperlink Interactive Ltd