www.webdeveloper.com
Results 1 to 2 of 2

Thread: JSP Resultset not iterating multiple times

Threaded View

  1. #1
    Join Date
    Sep 2010
    Posts
    15

    JSP Resultset not iterating multiple times

    Hi,

    I'm trying to use JSP resultset.next() multiple times to print HTML tables. However, it doesn't seem to want to work. I can print one or the other fine, but not both. I'm trying something below:

    Resultset rs = null;
    String SQL = "select column1, column2 from table";
    rs = stmtPROD.executeQuery(SQL);

    out.println("<table>")
    while(rs.next()) {
    out.println("<tr><td> " + rs.getString("column1") + "</td></tr>");
    out.println("</table><table>");

    while(rs.next()) {
    out.println("<tr><td> " + rs.getString("column2") + "</td></tr>");
    out.println("</table>");

    Any tips would be helpful. Thanks!
    Last edited by RunningDude87; 02-10-2014 at 10:36 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles