Title: RE: Java Servlet HTML

It should have been,
sb = new StringBuffer("<html>\n" +
                                "<head>\n") +
                                 "<title>My Website</title>\n") +
                                 "</html>\n"
                            );

-----Original Message-----
From: Sourabh Kulkarni [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 12:45 PM
To: [EMAIL PROTECTED]
Subject: Re: Java Servlet HTML


here you are not taking advantage of StringBuffer. You will be creating a
number of instances of String and then the final concatenated instance will
be set in the StringBuffer and that too with sb.append() method.

> sb =    "<html>\n" +
>         "<head>\n") +
>         "<title>My Website</title>\n") +
>         "</html>\n";

this assignment will give you following compile time error
incompatible types
found   : java.lang.String
required: java.lang.StringBuffer

I would prefer using append() so that you take the advantage of StringBuffer
class.
HTH,
-sourabh

___________________________________________________________________________
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

Reply via email to