<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"
    import="java.sql.*"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% 
String s = request.getParameter("start");
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String driverName = "com.mysql.jdbc.Driver";
try {
Class.forName(driverName); String url = "jdbc:mysql://localhost:3306/jdbc";
conn = DriverManager.getConnection(url, "root", "mysql");
st = conn.createStatement();
String sql = "select eno, ename, sex, inDate from emp limit "+s+", 1"; rs = st.executeQuery(sql);
out.print("<table border=1>");
while (rs.next()) {
out.print("<tr>");
out.print("<td>" + rs.getInt("eno") + "</td>");
out.print("<td>" + rs.getString("ename") + "</td>");
out.print("<td>" + rs.getString("sex") + "</td>");
out.print("<td>" + rs.getDate("inDate") + "</td>");
out.print("</tr>");
}
out.print("</table>");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
try {
st.close();
} catch (SQLException e) {
e.printStackTrace();
}
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}%><a href ="sql.jsp?start=0"> 首页 </a>
<a href ="sql.jsp?start=1"> 尾页 </a>
</body>
</html>