Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Building HTML Controls On The Fly

 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to create some HTML TEXT controls in a loop that will display the contents of a result set.
Below is what I came up with. This displays an empty TEXT field, but no data. I checked and the rs.getString(item) is returning some string data.
Can anybody tell me what change I need to make to the text below so it'll print out the rs.getString(item)>?
Thanks much.
-----------------------
out.println("<p><INPUT TYPE=TEXT, NAME= " + namVar + "VALUE= " + rs.getString(item)+"<p>");
(???)
 
George Larry
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

ITEM should be the name of the column in the db. (SELECT ITEM FROM TABLE), alternatively you can do this rs.getString( 1 ) which will return the 1st column your query returns.
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this worked after I uncommented "ITEM".
Thank you very much!!!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic