两种方法:
1、使用getParameterNames()来获取所有的参数名,然后分析这些名字,类似n*的就取出来。
2、如果你的n*是有规律的,例如n1,n2,...,n10,只不过最大值是动态的,那么可以多传一个参数:maxIndex,然后在服务器端for(i = 1; i < maxIndex; i++){ String name = "n" + i; String value = request.getParamete(name);}

解决方案 »

  1.   

    当然不行,数组提取的话建议你使用相同的name,改如下:
    <%@page contentType="text/html;charset=ISO8859_1"%>
    <html>
    <head><title>test</title></head>
    <body>
    <form mehtod="post">
    <input name="n"><br>
    <input name="n"><br>
    <input name="n"><br>
    <input type="submit" value="test">
    <% String[] res = request.getParameterValues("n"); %>
    result is:<%= res[0]%>
    </body>
    </html>