标题:[讨论]郁闷的作业五
取消只看楼主
囡囡也进论坛
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-12-20
 问题点数:0 回复次数:0 
[讨论]郁闷的作业五

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>

运行结果:

搜索更多相关主题的帖子: 打印机 作业 java import 
2006-12-20 17:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-110859-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.674917 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved