Questions about flush parameter in jsp:include and Tomcat

A

Andrea Desole

Hi,

after finding in a book, a decided to try to include a jsp page with
jsp:include setting the flush parameter to true. The book ("Core
Servlets and JavaServer Pages", page 271) also says that flush must be
set to true.
However, looking at the specification, I found out that the default
value is false; the specification also says that, when set to true,the
buffer is flushed "now". I also found out that, when set to true, in
case of error Tomcat simply doesn't display what comes after the include
page. I'm used at least to get a stack dump on my browser.
Now, I have two questions:
1) What does exactly "now" mean? Does it mean when the page is included?
Andis there any special reason to set it to true?
2) Why doesn't Tomcat show any error when it's set to true? Even if the
buffer is flushed the stack trace should still be shown.


Of course I solved the problem by setting flush to false, but it would
be nice to know how it works.

Thanks

Andrea
 
J

John C. Bollinger

Andrea said:
Hi,

after finding in a book, a decided to try to include a jsp page with
jsp:include setting the flush parameter to true. The book ("Core
Servlets and JavaServer Pages", page 271) also says that flush must be
set to true.
However, looking at the specification, I found out that the default
value is false; the specification also says that, when set to true,the
buffer is flushed "now". I also found out that, when set to true, in
case of error Tomcat simply doesn't display what comes after the include
page. I'm used at least to get a stack dump on my browser.
Now, I have two questions:
1) What does exactly "now" mean? Does it mean when the page is included?
Andis there any special reason to set it to true?
2) Why doesn't Tomcat show any error when it's set to true? Even if the
buffer is flushed the stack trace should still be shown.


Of course I solved the problem by setting flush to false, but it would
be nice to know how it works.

When the buffer is flushed, that part of the response that has already
been written to it is sent to the client. If the HTTP headers have not
yet been sent then it will be. At that point the servlet container is
committed to delivering that response; it cannot switch and deliver a
different one, such as an error page. It must deliver some or all of
the remainder of the response, or abort. It also cannot change or add
to the headers for the response, for the same reason.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top