value are same but name different

解决方案 »

  1.   

    to tomuno:
       你说的是什么意思呀?
      

  2.   

    写法都一样,只是页面写法不一样用nested:text
      

  3.   

    //jsp 页面<html:form action="myaction.do">
    <table>
    <tr>
    <td><html:text name="t1"></td><td><html:text name="t2"></td>
    <tr><tr>
    <td><html:text name="t1"></td><td><html:text name="t2"></td>
    <tr>
    </table>
    </html:form>
    //formbean 类
    class MyFormbean{
      String[] t1=new String[0];
      String[] t2=new String[0];
      
      public String[] getT1(){
        return t1;
      }
      public void setT1(String[] t1){
        this t1=t1;  
      }
      
      public String[] getT2(){
        return t2;
      }
      public void setT1(String[] t2){
        this t2=t2;  
      }  
    }如按上诉方法,提交后,在actionservlet中可以得到两组数值,而回显在文本框中的值就不对了
      

  4.   

    <html:form action="myaction.do">
    <table>
    <tr>
    <td><html:text name="t1"></td><td><html:text name="t2"></td>
    <tr><tr>
    <td><html:text name="t1"></td><td><html:text name="t2"></td>
    <tr>
    </table>
    </html:form>
    //formbean 类
    class MyFormbean{
      private String[] t1;
      private String[] t2;  
      public String[] getT1(){
        return t1;
      }
      public void setT1(String[] t1){
        this t1=t1;  
      }
      
      public String[] getT2(){
        return t2;
      }
      public void setT1(String[] t2){
        this t2=t2;  
      }
      public void doXXX(){
        int k1=0;
        if(t1!=null){
           k=t1.length;
        }
        int k2=0;
        if(t2!=null){
           k=t2.length;
        }    //现在可以取到每一个的t1,t2的值,OK了吗?  }  
    }如按上诉方法,提交后,在actionservlet中可以得到两组数值,而回显在文本框中的值就不对了