• Post Reply Bookmark Topic Watch Topic
  • New Topic

Save text from HTML textArea to database via Servlet

 
Juan Zhang
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I wrote a piece of text within the HTML textArea where I used "enter" to start new lines. I saved it to the database (MS Access) via Servlet. But when I opened
the database, only the first line of text is been saved. How can I save this whole text and keep the original format?
Thanks in advance
Juan
[This message has been edited by Juan Zhang (edited December 01, 2001).]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing you're using java.sql.Statement and building your SQL statement using "a bunch of text "+textAreaValue+" some more text"
If I'm right, try using a java.sql.PreparedStatement instead. (in fact, always use a PreparedStatement)
Dave.
 
Juan Zhang
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,
Thank you so much for your help. I saved and retrieved the text successfully after I use java.sql.PreparedStatement.
Thanks again.
Juan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!