Servlet: Placing an edit link on a dynamically created table

My question is more of a theory question. So i hope someone would give me an idea to point me in the right direction.

Visualise a table. And each rows are dynamically populated (as retrieved from a table in a database). The last two columns of the table is supposed to be an edit and delete link. They direct you to another page to do the respective actions. BUT how do we tell them which row of record it is?

while (rs.next()){
out.println("<tr>");
for (int i=1; i<=numCols; i++) {
out.print("<td>" + rs.getString(i) + “</td>” );
} // end for
**out.print ("<td>[ <a href=‘controlpanel_edituser.html’>Edit</a> ]</td>"); **
out.println("</tr>");
} // end while

Can i use session to store the information from each row? Or is it possible to use a input field (such as button invisibly) because i think buttons are not very pleasant looking.

Finally, when the page is redirected to the edit page, how can i populate the input fields quickly without having to query from the database again?

Hope that this is clear enough. Thanks for reading.