菜鸟的3个简单代码问题
JSP1.JSP
<html>
<head>
<title> 使用session制作在线购物 </title>
</head>
<body>
<form action= "jsp2.jsp " method=post>
<table border=1>
<tr>
<td> 商品名: </td>
<td> 价格: </td>
<td> 输入数量 </td>
</tr>
<tr>
<td> 商品1: </td>
<td> 1500 </td>
<td> <input type= "text " name=good1> </td>
</tr>
<tr>
<td> 商品2: </td>
<td> 1500 </td>
<td> <input type= "text " name=good2> </td>
</tr>
<tr>
<td> 商品3: </td>
<td> 1500 </td>
<td> <input type= "text " name=good3> </td>
</tr>
<tr>
<td> 商品4: </td>
<td> 1500 </td>
<td> <input type= "text " name=good4> </td>
</tr>
<tr> <td> 商品5: </td>
<td> 1500 </td> <td>
<input type= "text " name=good5> </td>
</tr>
<tr> <td cospan=3 align=center>
<input type= "submit " value= "确定 ">
<input type= "reset " value= "重新输入 "> </td>
</tr>
</table>
</form>
</body>
</html>
JSP2.JSP
<html>
<head>
<title> 在线购物 </title>
</head>
<body>
<%@page import= "java.util.* " %>
<%
String name,count;
request.getSession(true);
Enumeration goods=request.getParameterNames();
while(goods.hasMoreElements())
{
name=(String)goods.nextElement();
count=request.getParameter(name);
session.putValue(name,count);
}
String sname[]=session.getValueNames();
out.print( " <font size=5 color=green> 购买商品列表 </font> <p> ");
for(int i=0;i <sname.length;i++)
{
out.print(sname[i]+ " = ");
out.print(session.getValue(sname[i])+ " <br> ");
}
%>
</body>
</html>
问题1: