今天写了下web的登陆界面
<%@ page language="java" import="javax.sql.*" pageEncoding="utf-8"%>
<%@ page errorPage="error.jsp"%>
<html>
<head>
<title>图书管理系统</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<h1>图书管理系统</h1>
<a href="add.jsp">添加图书信息</a>
<br />
<br />
<table style="width: 50%;">
<tr>
<th>书名</th>
<th>作者</th>
<th>价格</th>
<th>管理</th>
</tr>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/book?useUnicode=true&characterEncoding=utf-8", "root", "stdusist");
//使用Statement对象
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from bookinfo");
/*
PreparedStatement stmt = con.prepareStatement("select * from bookinfo");
ResultSet rs = stmt.executeQuery();
*/
while (rs.next()) {
int id = rs.getInt(1);
out.println("<tr><td>" + rs.getString(2) + "</td><td>" + rs.getString(3) + "</td><td>"
+ rs.getString(4) + "</td><td><a href='edit.jsp?id=" + id
+ "'>修改</a> <a href='del.jsp?id=" + id + "'>删除</a></td></tr>");
}
rs.close();
stmt.close();
con.close();
%>
</table>
<br />
<hr />
<div style="text-align: center; width: 100%; font-size: 12px; color: #333;">
©版权所有:石家庄铁道大学信息科学与技术学院 <a href="Lab03.png" target="_blank">网站地图</a>
</div>
</body>
</html>