On Tue, 13 Nov 2001, Harden ZHU wrote:

> Date: Tue, 13 Nov 2001 03:31:38 -0500
> From: Harden ZHU <[EMAIL PROTECTED]>
> Reply-To: Tomcat Developers List <[EMAIL PROTECTED]>
> To: Tomcat Developers List <[EMAIL PROTECTED]>
> Subject: PageContext.include and flush
>
> JSP will do flush when call PageContext.include even make autoflush=false.

That's because of a statement in the Javadocs of PageContext.include()
that requires this behavior.

> So how can I call include or any similar function like include without
> flush?  Since in that include page, I have error checkings. If have errors,
> then will forward to some pages.
> Once JSP flushed, I can't do forward any more. Or any solution for that?
>

I'd suggest an approach based on what the generated code created by Jasper
does to implement <jsp:include ... flush="false"/>.  It calls a utility
method to wrap the current JspWriter() in a response, and uses
RequestDispatcher.include() to execute the included resource.  As a
result, the output is buffered to the current writer and the response is
not committed.

The runtime code that does this is the include() method of the
"org.apache.jasper.runtime.JspRuntimeLibrary" class, which you can get by
downloading the source version of Tomcat 4, or browse it in the online CVS
browser at the Jakarta web site.

> Thanks
>
> Harden
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to