<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import = "java.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<%
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/book";
Connection con = DriverManager.getConnection(url,"root","root");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from stu");
%>
<h1>学生信息</h1>
<table border = "1" width = "95%">
<tr>
<th>name</th>
<th>pwd</th>
<th>email</th>
<th>qq</th>
</tr>
<%while(rs.next()){ %>
<tr>
<td><%=rs.getString("username") %></td>
<td><%=rs.getString(2) %></td>
<td><%=rs.getString("email") %></td>
<td><%=rs.getString("qq") %></td>
</tr>
<%} %>
</table>
<%
rs.close();
stmt.close();
con.close();
%>
</body>
</html>
慕粉3291149
慕瓜9220888