| Author |
formatting the textarea form field in a servlet
|
Ulvi Cetin
Ranch Hand
Joined: Mar 03, 2003
Posts: 39
|
|
I have a textarea field in an HTML form. When the user submits the form, a servlet inserts the content of the textarea in Oracle database. When the contents of the textarea are retrieved from the database and displayed on a servlet or a JSP, line breaks and other formatting aren't displayed. I tried using the HTML PRE tag (preformatted), but that didn't fix the problem. Any ideas on how to store the textarea in a database and/or how to display the retrieved contents from the database. Thx. Ulvi. [ March 03, 2003: Message edited by: Ulvi Cetin ]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
Nothing to do with servlets really... But other than line breaks, what kind are formatting are you talking about? Not much else is possible. With regard to the line breaks themselves, are they coming back to you in the request parameter for the text area? If so, is something stripping them out going into or coming out of the DB? The text area control has some funky behavior on various browsers, and there are a slew of non-standard wrap attributes that some older browsers supported but whose behavior is non-deterministic. I'd suggest checking to see if the line breaks are being sent as part of the request parameter, and if not, reposting your question, along with the relevant HTML and handler code in the HTML forum. hth, bear [ March 03, 2003: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Ulvi Cetin
Ranch Hand
Joined: Mar 03, 2003
Posts: 39
|
|
Bear, thanks for your reply! I tried to view the contents of the textarea in the servlet (the one that is supposed to insert them into the database). I got the contents by request.getParameter("contents") and displayed them by out.println(contents) and I don't see line breaks in this output either. So, as you suggested, I think something is stripping the line breaks (before they are inserted in the database) between the form page and the servlet. But what?? Thx. Ulvi.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
Please post the code for your textarea in a topic in the HTML forum. hth, bear
|
 |
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
|
|
|
Tell you what, I will just move this to the html forum.
|
"JavaRanch, where the deer and the Certified play" - David O'Meara
|
 |
 |
|
|
subject: formatting the textarea form field in a servlet
|
|
|