aspose file tools*
The moose likes JSP and the fly likes Building HTML Controls On The Fly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Building HTML Controls On The Fly" Watch "Building HTML Controls On The Fly" New topic
Author

Building HTML Controls On The Fly

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1083
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

Joined: Nov 07, 2001
Posts: 52
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

Joined: Jul 12, 2002
Posts: 1083
Yes, this worked after I uncommented "ITEM".
Thank you very much!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Building HTML Controls On The Fly