有两个文件,SendPart负责构造表单,传送数据,ProPart负责显示刚才输入的信息。
可是,为什么当我以1,2,3为顺序输入数据时,它显示的结果是1,3,2顺序呢(书上的结果又是3,2,1)?它内部是怎么实现这个功能的?
我是新手,请解释得详细一些,先谢谢各位拉~~~
===========================================
SendPart:<%@page language="java" contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>getParameterName()方法应用</title>
</head>
<body bgcolor="#CCCC66">
<form method="post" action="Request_ProPart.jsp">
<font color="#FF0000" size="8">
<p>数据1:<input type="text" name="Sr1" /></p>
<p>数据2:<input type="text" name="Sr2" /></p>
<p>数据3:<input type="text" name="Sr3" /></p>
<p><input type="reset" value="reset">
&nbsp;&nbsp;
<input type="submit" value="submit"></p>
</font>
</form>
</body>
</html>========================================================
ProPart:<%@page language="java" contentType="text/html; charset=gb2312" import="java.util.*"%>
你刚才输入的信息是:<br>
<%
Enumeration e=request.getParameterNames();while(e.hasMoreElements())
{
String Name=(String)e.nextElement();
String Value=(String)request.getParameter(Name);
out.print("参数名称:"+Name+"&nbsp;");
out.print("参数值:"+Value+"<br>");
}
%>