Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Preserve line breaks in textarea

 
Darren Wheatley
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a form in a JSP that posts to a Servlet. The servlet extracts all of the field values in the form, uses StringBuffer to make a big string out of them all, and then uses that String as the body of an email.

Everything is working fine except where the user inputs more than one line in a <textarea>. The line breaks are being stripped out of the field when it is converted to a String.

So, instead of seeing this in my email:

Line1
Line2
Line3

- I get this:

Line1 Line2 Line3

Is there a way to preserve the line breaks?

Thanks

D.
[ October 06, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to do with JSP, so I've moved this off to the Servlets forum.

Some details regarding how you are "converting" will be necessary.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!