
Please check the error...
<%@ page language="java" import="java.sql.*" %>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=null;
ResultSet rst=null;
Statement stmt=null;
try
{
String a="jdbc:odbc:lib";
con=DriverManager.getConnection(a);
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
Statement st = con.createStatement();
rst=st.executeQuery("select * from books ");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Books</title>
<script language="javascript">
function validation()
{
var count=0;
for(var i=0;i<document.admin.chbox.length;i++)
{
if(document.admin.chbox[i].checked)
{
count++;
}
}
if(count==0)
{
alert("check the messages to delete & u had limited msg");
//document.msgchbox.checkbox.focus();
return false;
}
else
{
return true;
}
}
</script>
</head>
<body bgimage="header.jpg">
<form name="admin" method="post" action="deletepage.jsp" onsubmit="return validation()">
<center>
<h1><b><font color="white">Books Available </font></b></h1>
<input type="submit" value=" DELETE "/>
</div>
<table bgcolor="pink" border="1" cellspacing="0" cellpadding="0">
<tr>
<th bgcolor="darkblue"> <font color="yellow">S No.</font></th>
<th bgcolor="darkblue"> <font color="white">Group</font></th>
<th bgcolor="darkblue"><font color="white">Name</font></th>
<th bgcolor="darkblue"><font color="white">Author</font></th>
<th bgcolor="darkblue"><font color="white">Publisher</font></th>
<th bgcolor="darkblue"><font color="white">Edition</font></th>
<th bgcolor="darkblue"><font color="white">Copies</font></th>
<th>Delete</th>
</tr>
<%
int no=1;
while(rst.next())
{
%>
<tr>
<td><%=no%></td>
<td><%=rst.getString("group_")%></td>
<td><%=rst.getString("name")%></td>
<td> <%=rst.getString("author")%> </td>
<td> <%=rst.getString("publisher")%> </td>
<td> <%=rst.getString("edition")%> </td>
<td> <%=rst.getString("copies")%> </td>
<td><input type="checkbox" name="chbox<%=no%>" value="<%= rst.getString("name") %>" ></td>
</tr>
<%
no++;
}
rst.close();
stmt.close();
con.close();
%>
</table>
<u><h2><a href="Books.jsp"><font color="white">Back</font></a></h2></u>
<u><h2><a href="home.html"><font color="white">Home</font></a></h2></u>
</center>
</form>
</body>
</html>
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.