81,076
社区成员




<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY bgcolor=cyan>
<FONT Size=3>
<P>这里是食品柜台,请选择您要购买的食品:
<FORM action="" method=post name=form>
<input type="checkbox" name="choice" value="香肠" >香肠
<input type="checkbox" name="choice" value="苹果" >苹果
<input type="checkbox" name="choice" value="酱油" >酱油
<input type="checkbox" name="choice" value="饮料" >饮料
</BR>
<INPUT TYPE="submit" value="提交" name="submit">
</FORM>
<%
String foodName[]=request.getParameterValues("choice");
if(foodName!=null)
{
for(int k=0;k<foodName.length;k++)
{
session.setAttribute(foodName[k],foodName[k]);
}
}
%>
<P>点击超链接,连接到count.jsp的页面,去查看购物车中的商品。
<A HREF="count.jsp"> 欢迎去count.jsp!</A>
</FONT>
</BODY>
</HTML>
<%@ page contentType="text/html;Charset=GB2312" %>
<%@ page import="java.util.*" %>
<HTML>
<P>这里是结帐处,您的姓名以及选择的商品:
<%
String personName=(String)session.getAttribute("customerName");
out.println("<br>您的姓名:"+personName);
Enumeration enumGoods=session.getAttributeNames();
out.println("<br>购物车中的商品:<br>");
while(enumGoods.hasMoreElements())
{
String key=(String)enumGoods.nextElement();
String goods=(String)session.getAttribute(key);
if(!(goods.equals(personName)))
out.println(goods+"<br>");
}
%>
<P>
点击超链接,连接到food.jsp的页面,购买食品。
<A HREF="food.jsp"> 欢迎去food.jsp!</A>
<P>
点击超链接,连接到main.jsp的页面,去修改姓名。
<A HREF="main.jsp"> 欢迎去main.jsp!</A>
</FONT>
</BODY>
</HTML>