String buffer help please


General J2EE: String buffer help please

  1. String buffer help please (2 messages)

    When i run the following code, the output is not displaying in a new line but displays everything in a same line. Any advice please. I'm struggling but cant get it solved. this is kind of urgent any help is great...

    StringBuffer s = new StringBuffer(4000);
    s.append("Name: " + custNamerequestedAmt + "\n");
    s.append("Phone: " + custPhone + "\n");
    s.append("Email: " + custEmail + "\n");

    Also I want to bold the headings of the column the name and phone, how can i acheive this.

    Threaded Messages (2)

  2. String buffer help please[ Go to top ]

    I tried your code its working fine & output is displaying in a new line.
  3. String buffer help please[ Go to top ]

    Another time it would be a good idea to post some more details about your problem. Since it may be that this is a homework I won't give an exact answer but rather give some guidance.

    I would guess that you are trying to get some output on an HTML page. HTML is not supposed to care about newlines or white spaces when presenting its output so you have to find out how to do a newline in HTML and insert ít into the code. A good way to find ouy how HTML is written is to look at the source of any web page. Bote IE and Firefox has "view source" options in the menu. Nowadays not many developers put presentation logic like HTML tags in the JAva code but uses a presentation framework based on JSP to accomplish HTML output.

    Good luck.