explain exactly what "rs.next()" do in addition to its return value.
When you get the result set, it cursor is under the first line. So to get the data you need first to move cursor to the first line. rs.next() shifts the cursor to the next row of the result set from the database and returns true if there is any row, otherwise returns false. It can you in a while loop like this:
if (rs.next()) {
}
You can also use additional method hasNext(), that return true is there is a next row.
if(rs.hasNext()) {
rs.next();
// do something
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF