code088.jsp
<%@page import="pack02.code086"%>
<%@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>
<jsp:useBean id="findBook" class="pack02.code087"></jsp:useBean>
<table border="1">
<tr>
<td colspan="5">所有图书信息</td>
</tr>
<tr>
<td>ID</td>
<td>图书名称</td>
<td>价格</td>
<td>数量</td>
<td>作者</td>
</tr>
<%
List<code086> list1 = findBook.findAll();
if(list1 == null || list1.size() < 1)
{
out.println("没有数据!");
}
else
{
for(code086 book : list1)
{
%>
<tr>
<td><%= book.getId() %></td>
<td><%= book.getName() %></td>
<td><%= book.getPirce() %></td>
<td><%= book.getBookCount() %></td>
<td><%= book.getAuthor() %></td>
</tr>
<%
}
}
%>
<%--
mysql中的存储过程
delimiter $$
create procedure findAllBook()
begin
select * from tb_books order by id desc;
end $$
delimiter;
--%>
</table>
</body>
</html>