Im trying to create three pages for Inserting, deleting or viewing database contents. On my main or home page the database contents are shown. I want to create a "Delete" hyperlink in the last column of every row so that the specific record is deleted on clicking that. I just knw how to create the hyperlink. I dont remember how to parse the ID of the record to be deleted. Please help.

Recommended Answers

All 2 Replies

<a href="page.jsp?id=5">Text</a>

Or for a dynamic link jsp:

<a href="page.jsp?id=<%=id%>">Text</a>

Where 'id' is a java variable

Eh.. i used a while loop. Thanx for helping me out on that line. Here is what i have.

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        The Current Table Data is :- <br>

        java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:WoW");
        java.sql.Statement s =con.createStatement();
        java.sql.ResultSet r =s.executeQuery("select * from Char");

                <table border="2">
                        <td>Character Name</td>

               Integer  v;
               String  url;    
               while (r.next()){


                  url="<a href=Asgn1.3.jsp?id=" +  v.toString()+ ">Delete Record</a>";


                   <td><%=url %></td>
                   <td><%=v %></td>

               <% }


                Please Enter The Character Details Below
        <form name="frm" action="Asgn1.2.jsp" method="get">
          Index : <input name="Roll" type="text" /> <br>
          Name  : <input name="Name" type="text" /> <br>
          Level : <input name="Level" type="text" /> <br>
          Location : <input name="Location" type="text" />
          <input type="submit" value="Save" />

Be a part of the DaniWeb community

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