The moose likes Java in General and the fly likes displaying database records rowwise in the table Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "displaying database records rowwise in the table" Watch "displaying database records rowwise in the table" New topic
Author

displaying database records rowwise in the table

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
How to display database records rowwise in the table?

I have a resultset and each record has to be displayed rowwise in the table...

is it possible?


Abhishek
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Define table. Is it an HTML table? JTable?


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Jilesh Lakhani
Ranch Hand

Joined: Jul 26, 2006
Posts: 47

create a table and inside a while loop ..
while(rs.next()) {
<td>rs.getString(1)</td>
}

you can do something like this.... I may be wrong with HTML syntax but hopefully you can take it forward from here.

check with java.sql.resultset

-Jilesh
Universe and Knowledge has no bounderies
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56185
    
  13

Please take the time to choose the correct forum for your posts. This forum is for questions on advanced Java. Not only is this not an advanced question, it's not a general Java question. For more information, please read this.

Assuming that you meant an HTML table, this post has been moved to a more appropriate forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56185
    
  13

A resultset should never get anywhere near the UI or a JSP.

Capture the data from the resultset in an appropriate Java collection and close the resultset as soon as possible. Pass the collection back to the controller for sending to the JSP for display.

 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: displaying database records rowwise in the table
 
Similar Threads
javax.servlet.ServletException: java.lang.IndexOutOfBoundsException: Index: 6, Size: 0
SELECT QUERY
How to insert records in ms-access table using jdbc console application.
Writing to an excel sheet from java servlet
Doubt on Servlet having database connection?