• Post Reply Bookmark Topic Watch Topic
  • New Topic

get values from databse to html textarea  RSS feed

 
jop
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can somebody tell me how i can fill the textarea(multiline text) with the database value.
I did the following
Comments <textarea name="comments" cols="20" rows="2" value = "<%= rs.getString("Comments") %>" ></textarea
This dint work.
Thanks,
jop
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That use of value is the syntax for <INPUT fields, not <TEXTAREA - put the text between the start and end tags.
The best way to approach form building in JSP (IMHO) is to create a prototype plain HTML page that does what you want so you can get the HTML tags right, then turn that page into JSP.
Bill
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The reason it didn't work is that unlike INPUT, the TEXTAREA tag has no "value" attribute. The correct form is

However, you must be careful NOT to have anything that looks like HTML (particularly broken HTML) in the value you substitute, because the user's browser will get confused unless you escape it.
Example:

VERY BAD. svalue should be escaped ("Is a &lt; b???")
... And would you believe I had to "correct" this posting because the JavaRanch software didn't escape the "&"? THAT's how dangerous it is!
[ January 08, 2002: Message edited by: Tim Holloway ]
[ January 08, 2002: Message edited by: Tim Holloway ]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"jop"
your name doesn't agree with the javaranch guidelines. Please take a moment and re-register after reviewing the guidelines at http://www.javaranch.com/name.jsp
Thanks for your cooperation.
- satya
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!