Display data from db to JSP page with update and delete links corresponding each row? -


this question has been asked many times. extending it. want display database table data onto jsp page table , 2 links follow each row. first is, update. second, delete. assume each row has id associated coming database itself, how can create links , pass id when press delete, corresponding row deleted. also, how update values id?

<table border="1">         <tr>             <th>id</th>             <th>name</th>             <th>address</th>             <th>update</th>             <th>delete</th>         </tr>         <% while(resultset.next()){ %>          <tr>             <td> <%= resultset.getstring(1) %></td>             <td> <%= resultset.getstring(2) %></td>             <td> <%= resultset.getstring(3) %></td>             <td> <a href="#">update</a> </td>             <td> <a href="#">delete</a> </td>         </tr>         <% } %>     </table> 

first of have created tow different ulr of 1 common url different parameters updation,deletion. find below code delete or update particular record.

assume delete jsp del.jsp , update jsp update.jsp

<table border="1">         <tr>             <th>id</th>             <th>name</th>             <th>address</th>             <th>update</th>             <th>delete</th>         </tr>         <% while(resultset.next()){ %>          <tr>             <td> <%= resultset.getstring(1) %></td>             <td> <%= resultset.getstring(2) %></td>             <td> <%= resultset.getstring(3) %></td>             <td> <a href="update.jsp?id=<%=resultset.getstring(1) %>">update</a> </td>             <td> <a href="del.jsp?id=<%=resultset.getstring(1) %>">delete</a> </td>         </tr>         <% } %>     </table> 

get id value in form on del.jsp , update.jsp , update or delete values corresponding id.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -