5.参考程序shop.jsp
把灯泡的价格改为85,把打印机的价格改为650
shop.jsp<%@page language="java" c%>
<%@ page import="java.io.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
<head>
<META http-equiv=Content-Type c>
</head>
<body>
<jsp:useBean id="shop" scope="session" class="ch9_1.shopping"/>
<%
String sitem=null;
int item=0;
sitem=request.getParameter("Item");
if(sitem==null)
{
sitem="";
}
else
{
Integer tmpInt=new Integer(sitem);
item=tmpInt.intValue();
}
String scount=null;
int count=0;
scount=request.getParameter("Count");
if(scount==null)
{
scount="";
}
else
{
Integer tmpInt=new Integer(scount);
count=tmpInt.intValue();
}
String message=null;
%>
<center>
<table border="1" cellpadding="3" cellspacing="1">
<tr>
<td>图像</td>
<td>名称及介绍</td>
<td>价格</td>
<td>加入购物篮</td>
</tr>
<%
for(int i=0;i<shop.getCount();i++)
{
%>
<tr>
<td>
<img src="<%=shop.getItemImage(i)%>" height="120" width="120">
</td>
<td width="50%"><%=shop.getItemDesc(i)%></td>
<td><%=shop.getItemPrice(i)%></td>
<td>
<a href="add.jsp?Item=<%=i%>&Count=1">
加入购物篮
</a>
</td>
</tr>
<%
}
%>
</table>
</center>
</body>
</html>
运行结果: