It is always recommended to use StringBuffer instead of String even for Concatenating a group of Strings. Avoid writing every small string to client. Instead store all the strings into a StringBuffer and after sufficient data is available, send this data to Browser.
Here is some sample code,
PrintWriter out =res.getWriter();
StringBuffer sb = new StringBuffer();
//concatenate all text to StringBuffer
sb.append("............. ")
res.setContentLength(sb.length());
out.print(sb);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment