Best way to write text content from servlet

B

Bruce Lee

Just curious to what is the best performing way of writing dynamic content
out. Is it :
-build content in a string buffer
-out.println(stringbuffer.toString())

If there's a task underway that may take a few seconds is it a good idea to
print out something straight away - like the top of the page 1st - then
write out the body which is in the StringBuffer?
 
J

Jon Martin Solaas

Bruce said:
Just curious to what is the best performing way of writing dynamic content
out. Is it :
-build content in a string buffer
-out.println(stringbuffer.toString())

If there's a task underway that may take a few seconds is it a good idea to
print out something straight away - like the top of the page 1st - then
write out the body which is in the StringBuffer?

In my opinion buffered looks better, but it all depends. If it's only
the last 10% that is delayed/slow, the user might get the wrong
impression that the page is fully loaded when it's only 90% loaded.
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top