Sunday, May 20, 2012

what is the meaning of out.flush() methode in jsp

consider the following lines below in the jsp service method  ,  _jspService()

out.write(<<some text>>);
out.write(<<some text1>>);
out.write(<<some text2>>);

in this case all the text in the write method will go at once to the client,
if u want the some text will go first then some text1 after that some text2 then we can have the logic like below


out.write(<<some text>>);
out.flush();
out.write(<<some text1>>);
out.flush();
out.write(<<some text2>>);
out.flush();


so here some text will go the client after first flush method with out waiting for the some text1.

that is the usage of flush method.

1 comment:

  1. Thank you. Simple explanation that I needed :-)

    ReplyDelete