<%@ page language="java" contentType="text/html; charset=GB2312"
	pageEncoding="GB2312"%>
<%@ page import="java.util.Collection,java.util.Iterator"%>
<%@ page import="com.wxpn.tutorial.ec.bean.ECBook"%>
<%@ include file="../include/header.jsp"%>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=760 align="center">
	<TBODY>
		<tr>
			<td align="left" height=25><%if (session.getAttribute("username") != null) {
				out.println(session.getAttribute("username"));
			}%> 当前位置：<a href="../index.jsp">首页</a> -&gt; 成员服务</td>
			<td align="right"><%@ include file="../include/date.jsp"%></td>
		</tr>
		<TR bgColor=#3399ff>
			<TD height=1 colspan="2"><IMG height=1 src="images/spacer.gif"
				width=16></TD>
		</TR>
		<tr>
			<td height=10 colspan="2"><IMG height=1 src="images/spacer.gif"
				width=16></td>
		</tr>
	</TBODY>
</TABLE>

<table align="center" border="0" width="760" cellspacing="0"
	cellpadding="0" height="355">
	<tr>
		<td width="150" height="355" valign="top"><%@ include
			file="../include/top_banner.jsp"%></td>
		<td width="10" height="100%"></td>
		<td width="1" height="100%" bgcolor="#3399ff"></td>
		<td width="10" height="100%"></td>
		<td width="589" height="331" valign="top" background="images/bg1.gif">
		<table border="0" width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td width="40%" height="20" bgcolor="#3399ff">&nbsp;<font
					color="#ffffff">标题</font></td>
				<td width="15%" height="20" bgcolor="#3399ff">&nbsp;<font
					color="#ffffff">作者</font></td>
				<td width="15%" height="20" bgcolor="#3399ff">&nbsp;<font
					color="#ffffff">类别</font></td>
				<td width="15%" height="20" bgcolor="#3399ff">&nbsp;<font
					color="#ffffff">价格</font></td>
				<td width="15%" height="20" bgcolor="#3399ff">&nbsp;<font
					color="#ffffff">库存</font></td>
			</tr>
			<%if (request.getAttribute("c") == null) {

			%>
			<tr>
				<td width="" 75%"" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何书籍。</td>
			</tr>
			<%} else {
				Collection c = (Collection) request.getAttribute("c");
				if (c == null) {

				%>
			<tr>
				<td width="" colspan=5 bgcolor="#FCFCFC" align=center>还没有任何书籍。</td>
			</tr>
			<%} else {
					int totalPageNum = ((Integer) (request
							.getAttribute("totalPageNum"))).intValue();
					int currentPage = 1;
					if (request.getParameter("page") != null) {
						currentPage = Integer.parseInt(request
								.getParameter("page"));
					}
					Iterator iterator = c.iterator();
					while (iterator.hasNext()) {
						ECBook book = (ECBook) iterator.next();

						%>
			<tr>
				<td width="40%" bgcolor="#FCFCFC"><a
					href="ShowBookServlet?id=<%=book.getId()%>" target="_blank"><%=book.getName()%></a></td>
				<td width="15%" bgcolor="#FCFCFC"><%=book.getAuthor()%></td>
				<td width="15%" bgcolor="#FCFCFC"><%=book.getStrCategory()%></td>
				<td width="15%" bgcolor="#FCFCFC"><%=book.getPrice()%></td>
				<td width="15%" bgcolor="#FCFCFC"><%=book.getStock()%></td>
			</tr>
			<%}%>
			<form name="form1" method="get">
			<tr>
				<td width="" colspan=5 align=right bgcolor="#EFEFEF"><%for (int i = 1; i <= totalPageNum; i++) {%>
				<a href="BookListServlet?page=<%=i %>">[<%=i%>]</a> <%}

					%>共[<%=request.getAttribute("totalPageNum")%>]页 <input type="text"
					size="2" name="page" value=""><input type="submit" name="go"
					value="Go"></td>
			</tr>
			</form>
			<%}
			}

		%>
			<tr>
				<td colspan="2" align="right">&nbsp; 商品分类：<a
					href="/ECommerce/CategoryServlet?id=1">计算机类</a> | <a
					href="/ECommerce/CategoryServlet?id=2">英语类 </a> | <a
					href="/ECommerce/CategoryServlet?id=3">其他类 </a> |</td>

			</tr>

		</table>


		</td>
	</tr>
</table>
<%@ include file="../include/footer.jsp"%>
