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("Name: " + custNamerequestedAmt+"\n"); //s.append('\n'); // also tried this but did not work s.append("Phone: " + custPhone + "\n"); s.append("Email: " + custEmail + "\n"); s.toString();
Also I want to bold the headings of the column the name and phone, how can i acheive this.
Is this in a servlet or JSP, so the output is going to HTML? If so, then you have to use explicit "<BR>" elements as line breaks; "\n" will be ignored. Of course, it would be better to use a "<TABLE>" element to structure your whole table; while you're at it, you could use "<TH>" (table header) elements for the headers, suitably styled.
Sounds like you haven't done step 1 properly because you aren't clear on how newlines work in HTML. I thought you didn't have to change them to <br> in a text area but I'm not clear on that either. So just create some little HTML pages in a text editor and see what works.