The following code is a part of my project and the output of this code is that i get all the title of the posts in the database and a delete hyperlink in front of all enteries now when i click delete for a respective title it should be deleted from jsp page how to write code for this? For better understanding i have attached a screen shot also.

<label><h3>
                            Post published:
                        </h3></label>
                        <%
                                    rs = stmt.executeQuery("select title from Postdata");
                        %>

                    <table id="rounded-corner" summary="all posts">
                        <thead>
                            <tr>

                            </tr>
                        </thead>
                        <tfoot>

                        </tfoot>
                        <tbody>
                            <% while (rs.next()) {%>
                            <tr>
                                <td>
                                    <%=rs.getString(1)%>
                                </td>
                                <td>

                                    <a href><%=""%>Delete</a>
                                </td>
                            </tr>
                            <%}%>
                        </tbody>
                    </table>

Don't use scriptlets. You should choose to use the JSTL and EL. The use of scriptlets is officially discouraged since JSP 2.0 and the birth of taglibs.

As per your requirement, you need to embed title (column) value at href attribute of each anchor tag.

<%
 String paraction=request.getParameter("action");
 String paratitle=request.getParameter("title");

 if(paraction!=null)
  {
     //put deletion code here
   }
%>


 <% while (rs.next()) {
    String title=rs.getString(1);
   %>
  <tr>
    <td><%=title%></td>
    <td><a href="page.jsp?action=delete&title=<%=title%">Delete</a></td>
 </tr>
....
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.