
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Internet Dreams</title>
<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" title="default" />
<link rel="stylesheet" media="all" type="text/css" href="c1ss/pro_dropline_ie.css" />
<script type="text/javascript">
function validateForm()
{
var x=document.form1.id.value;
if (x==null || x=="")
{
alert("Retailer Id cannot be empty");
return false;
}
/*var r=confirm("Untag the products?")
if(r==true)
{
confirm("Are you sure you want to delete retailer?")
}*/
}
</script>
</head>
<body>
<div id="page-heading"><h1>Delete Retailer</h1></div>
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
<th class="topleft"></th>
<td id="tbl-border-top"> </td>
<th class="topright"></th>
<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
<td id="tbl-border-left"></td>
<td>
<!-- start content-table-inner -->
<div id="content-table-inner">
<form name="form1" action="RetController" onsubmit="return validateForm();">
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td>
<!-- start step-holder
<div id="step-holder">
<div class="step-dark-left"><a href="">Registration Form</a></div>
<div class="step-dark-right"> </div>
</div>
end step-holder -->
<br/>
<!-- start id-form -->
<table border="0" cellpadding="0" cellspacing="0" id="id-form">
<tr>
<th valign="top">Enter Retailer Id:</th>
<td><input type="text" name="id" id="id" class="inp-form" /></td>
<td></td>
</tr>
</td>
<td></td>
</tr>
<tr>
<th> </th>
<td valign="top">
<input type="submit" name="submit" value="ret_id" /></td>
<td valign="top"> <input type="reset" value="" class="form-reset" />
</td>
<td></td>
</tr>
</table>
</form>
<!-- end id-form -->
</td>
<td>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

The given code allow the user to enter any id, whose record is to be removed from database. This id is then send to action page to delete that particular record.
1)form.jsp:
< form method="post" name="form" action="delete.jsp" >
Enter Id: < input type="text" name="id">< br>
< input type="submit" value="Submit">
< /form>
2)delete.jsp:
<%@page import="java.sql.*"%>
<% String id=request.getParameter("id"); int no=Integer.parseInt(id); int sumcount=0; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root"); Statement st = conn.createStatement(); st.executeUpdate("DELETE FROM employee WHERE id = '"+no+"'"); response.sendRedirect("application.jsp"); } catch(Exception e){} %>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.