日期:2014-05-18  浏览次数:20693 次

文本框数组~查了很久还是没找到解决办法~
我想要将文本框数组的值传到text2.jsp的页面并输出
text1.jsp的代码
<form   name= "form1 "   method= "post "   action= "text2.jsp ">
  <td   height= "28 "> </td>
  <%
      for(int     i=1;i <=3;i++){
      %>
    <tr   align= "center ">
      <td   height= "33 "> <input   name= "ckname[i] "   type= "text "   size= "20 "   > </td>
      <td   height= "33 "> <input   name= "ckpersonalcode[i] "   type= "text "   size= "20 "   > </td>
      <td   height= "33 "> <input   name= "cktel[i] "   type= "text "   size= "20 "   > </td>
        </tr>
      <%}%>
                               
      <input   name= "sure "   type= "submit "   value= "sure "   >
      </form>
text2.jsp的代码:
<%
                     
                      for(int   i=1;i <=3;i++){
                        String   a[]=request.getParameterValues( "ckname[i] ");
                        String   b[]=request.getParameterValues( "ckpersonalcode[i] ");
                        String   c[]=request.getParameterValues( "cktel[i] ");
                        }%〉
不知道用这种方法穿值对吗?可是我想要输出a[],b[],c[]的值,应该怎么做?谢谢大家先~

------解决方案--------------------
text1.jsp的代码
<form name= "form1 " method= "post " action= "text2.jsp ">
<td height= "28 "> </td>
<%
for(int i=1;i <=3;i++){
%>
<tr align= "center ">
<td height= "33 "> <input name= "ckname[] " type= "text " size= "20 " > </td>
</tr>
<%}%>

<input name= "sure " type= "submit " value= "sure " >
</form>
text2.jsp的代码:
<%
String a[]=request.getParameterValues( "ckname[] ");
%〉