code080.jsp
<%@page import="pack02.code078"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>显示图书列表</title>
</head>
<body>
<table border="1">
<tr>
<td colspan="5">所有图书信息</td>
</tr>
<tr>
<td>ID</td>
<td>图书名称</td>
<td>价格</td>
<td>数量</td>
<td>作者</td>
</tr>
<%
List<code078> list1 = (List<code078>)request.getAttribute("list");
if(list1 == null || list1.size() < 1)
{
out.println("没有数据");
}
else
{
for(code078 book : list1)
{
%>
<tr>
<td><%= book.getId() %></td>
<td><%= book.getName() %></td>
<td><%= book.getPrice() %></td>
<td><%= book.getBookCount() %></td>
<td><%= book.getAuthor() %></td>
<td>
<form action="pack02.code082" method="post">
<input type="hidden" name="id" value="<%= book.getId() %>">
<input type="text" name="bookCount" id="bookCount" size="3" required="required">
<input type="submit" name="submit" value="修改">
</form>
</td>
<td>
<a href="pack02.code083?id=<%= book.getId()%>">删除</a>
</td>
</tr>
<%
}
}
%>
<%--
create table tb_books (
id int auto_increment not null primary key comment '图书编号',
name varchar(45) not null comment '图书名称',
price double not null comment '价格',
bookCount int not null comment '数量',
author varchar(45) not null comment '作者'
)
--%>
</table>
<a href="code076.jsp">添加图书</a>
</body>
</html>