Delete through jsp.
<%@page import="java.sql.*"%>
<%
try
{
int id=Integer.parseInt(request.getParameter("id"));
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/naveen","root","");
PreparedStatement pst=con.prepareStatement("delete from department where id=?");
pst.setInt(1,id);
int a=pst.executeUpdate();
if(a>0)
{
%>
<a href="view.jsp">View All Records</a>
<%
}
else
{
%>
<jsp:forward page="view.jsp"></jsp:forward>
<%
}
}
catch(Exception e)
{
out.print(e.getMessage());
}
%>