日期:2014-05-17 浏览次数:20708 次
<%@ page language="java" import="java.util.*,com.hsp.domain.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'hall.jsp' starting page</title>
</head>
<body>
<h1>欢迎进入购物大厅</h1>
<table border="1">
<tr><td>书名</td><td>价格</td><td>出版社</td><td>点击购买</td></tr>
<%
ArrayList al = (ArrayList)request.getAttribute("books");
for(int i=0;i<al.size();i++){
Book book = (Book)al.get(i);
%>
<tr>
<td><%=book.getName()%></td>
<td><%=book.getPrice()%></td>
<td><%=book.getPublish()%></td>
<td><a href="/myshopping/ShoppingClServlet?id=<%=book.getId()%>">购买</a></td>
//这里的超链接地址是写正确了的为什么还是要报404啊。
</tr>
<%
}
%>
<tr><td colspan="4"><input type="button" value="查看购物车"></td></tr>
</table>
<a href="/myshopping">返回重新登录</a>
</body>
</html>