<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Display Records</title>
</head>
<body>
<%-- Importing SQL --%>
<%@ page import = "[Link].*" %>
<center><h2>Displaying Student Records</h2></center>
<%-- Working with JDBC --%>
<%
try {
[Link]("[Link]");
String url ="jdbc:mysql://localhost:3306/studentdbwithjsp" ;
String username="root";
String password="";
Connection conn =
[Link](url,username,password);
Statement stmt = [Link]();
String Query = "SELECT * FROM student";
ResultSet rs = [Link](Query);
%>
<table border="2" align="center" cellpadding="10" width="30%">
<tr> <th> ID </th> <th> Name </th> <th> Age </th> </tr>
<% while([Link]()) { %>
<tr>
<td> <%= [Link](1) %> </td>
<td> <%= [Link](2) %> </td>
<td> <%= [Link](3) %> </td>
</tr>
<% }
[Link]();
}
catch (Exception e) {
[Link]("Error: "+e);
}
%>
</body>
</html>