Actually, String concatanation seems to create a lot of unnecessary objects
and this is what is inefficient. I'm not sure that a lot of println's are
necessarily a problem. There is a good article in JavaWorld by Paul Philion
about this, see:
http://www.javaworld.com/javaworld/jw-12-1998/jw-12-servlethtml.html
Following the article, creating a StringBuffer and appending to it would be
the most efficient.
Lloyd
----- Original Message -----
From: Cezar Totth <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 26, 1999 11:54 AM
Subject: Re: Fw: (is servlet really faster?) Php
VsServlet,unexpectedresult,why?
> More improvement you should get if you handle to reduce println(s)
> by declaring a local (or even static) String variable with
> something like:
>
> String documentHeader = "<HTML>\n" + ...
> "<HEAD>" + ....
> "<TITLE>...</TITLE>" +
> ///... blah, blah... what ever is "constant" within
> // html page, until you use "dynamic" printing" ...
>
> ;
> String documentFooter =... "</BODY>\n" + "</HTML>";
>
> so within doPost you'll need only:
>
> out.println(documentHeader);
> ... print here your generated Date or SQL results.
> out.println(documentFooter);
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html