Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to call <a href="http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html#next()" rel="nofollow noreferrer"><code>ResultSet#next()</code></a> to move the cursor to the next row, otherwise you cannot access any data from the row. If you expect multiple rows, do this in a <code>while</code> loop:</p> <pre><code>while (rset1.next()) { System.out.println(" name -&gt; " + rset1.getString(2)); } </code></pre> <p>Or if you expect only one row, then do this in an <code>if</code> statement:</p> <pre><code>if (rset1.next()) { System.out.println(" name -&gt; " + rset1.getString(2)); } </code></pre> <h3>See also:</h3> <ul> <li><a href="http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html" rel="nofollow noreferrer">JDBC tutorial</a></li> <li><a href="https://stackoverflow.com/questions/1813858/sqlite-3-jdbc-driver-throws-resultsset-closed-exception-on-empty-resultset/1814443#1814443">How to iterate through a ResultSet</a></li> </ul> <hr> <p>That said, this code is honestly said not the right way to achieve the functional requirement of displaying the data from a DB in a HTML table. This database interaction task shouldn't be done inside a JSP file, but in a real Java class. The JSP page should be kept <em>scriptlet</em>-free.</p> <h3>See also:</h3> <ul> <li><a href="https://stackoverflow.com/questions/3177733/howto-avoid-java-code-in-jsp-files/3180202#3180202">How to avoid Java code in JSP files</a></li> <li><a href="https://stackoverflow.com/questions/2280034/jsp-helper-class-for-printing-content/2280358#2280358">How to display data from database in a HTML table in JSP page</a> </li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload