what is the use of flush in jsp?

Discussions

Web tier: servlets, JSP, Web frameworks: what is the use of flush in jsp?

  1. what is the use of flush in jsp? (3 messages)

    hi , can anyone tell the purpose or use of flush in jsp??

    Threaded Messages (3)

  2. flush will pump the available output in the responsebuffer right away to the browser, ie you can write cunks of content in steps. For eg; We can render an html Div with an animated image (like a hour glass) showing the status of the page downloading in process, while the page is still being buffered and once the content is fully buffered, you may append some javascript to hide the hour glass and render the content to the screen once the processing is finished.
  3. doubt in flush[ Go to top ]

    hi I have read HFSJ book where the purpose of flush is stated as Once the flush method is invoked ,the response object is commited. commited means the response is sent to the client. but below in this samplecoding "); out.flush(); out.write("This will also print!
    "); out.flush(); out.write("This will get sent to the client too!
    "); %> my doubt is 1., If a flush method is used ,is the response is commited or not? 2., If the response is commited means ,then how can we use flush or print message once again ?? please clarify me.
  4. Re: doubt in flush[ Go to top ]

    hi
    I have read HFSJ book where the purpose of flush is stated as


    Once the flush method is invoked ,the response object is commited.
    commited means the response is sent to the client.

    but below in this samplecoding


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



    my doubt is

    1., If a flush method is used ,is the response is commited or not?
    2., If the response is commited means ,then how can we use flush or print message once again ??

    please clarify me.
    out.write("This will print!
    ");
    out.flush(); // here the contents in the outputstream is already sent to the browser, while you can still write other stuff like below to the outputstream, and flush the contents on will.
    out.write("This will also print!
    ");
    out.flush();
    out.write("This will get sent to the client too!
    ");
    %>