• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

The purpose of flush attribute in jsp:include

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
I have a doubt regarding flush attribute .
In <jsp:include page="relativeurl" flush="true" /> what is the purpose of flush attribute here.can we use it in forward tag also??.
can anyone help me.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the jsp 2.0 spec


The flush attribute controls flushing. If true, then, if the page output is buffered and the flush attribute is given a true value, then the buffer is flushed prior to the inclusion, otherwise the buffer is not flushed. The default value for the flush attribute is false.


forward doesn't let you write something before forwarding. So it's of no use in a forward action
More on the use of flush in include action please read this
discussion
 
Naveen Kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
consider this sample coding given by Marc Peabody .

<%
out.write("This will print!<br/>");
out.flush();
out.write("This will also print!<br/>");
out.flush();
out.write("This will get sent to the client too!<br/>");
%>

by default jsp pages are buffered.that means the stuff written to the JspWriter (out) object does not immediately or directly goes to the client through the response.

the character are stored in the buffer and once we flush it everything in the buffer goes to the client through the response object.

but in the above coding. the flush is been used many times.
my doubt is on each time we are invoking the flush method on out object means each time it gets the datas stored in the buffer is sent to the client through the response object??
for example :
flush is used 2 times in the above code.
then response object will be invoked twice??
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic