table里的有多行
举个例子,Person里有两个属性,一个是name,一个是address,table一行有两列,一个是姓名,一个地址,对应着Person的属性,如何一次性传给后台action呢?
补充一下,是structs2
新手拜谢各位大神了
JSP

解决方案 »

  1.   

    就是  我的一个Jsp页面里有个table 里面有多行数据 数据类型是Person  它里有两个属性,一个是name,一个是address,table一行有两列,一个是姓名,一个地址,对应着Person的属性现在我要提交到后台 存到数据库里去  我想问的是 action 里面用什么来接收这个table里面的所有数据值
      

  2.   

    在table 外面套一个form  ,提交表单会把所有参数 全部提交到后台Action中,,
    其中 定义private Person person;  加上set 方法,,然后就可以取到了。。
      

  3.   

    通过表单传值,set,get方法取值后,然后提交
      

  4.   

    action 定义 Persion persion前台控件name persion.name,persion.address
      

  5.   

    可以提交。后台会接收到一个person数组
      

  6.   

    你在table外面套一个form,不就可以把参数都传过去了么。
      

  7.   

    <table>
    <tr><td>
    <form id="formId">
    <table>
    <tr><td><imput name="loginName"></td><tr>
    <tr><td><imput name="passWord"></td><tr>
    </table>
    </from>
    </td></tr>
    </table>
    <script>
    document.getElementById('formId')action="你的action";
    document.getElementById('formId').submit();
    </script>
    就把表单的数据提交了,表单的name跟action的的属性对应即可。
    action:
    private String loginName;
    private String passWrod;
    get跟set方法;
      

  8.   

    上面的
    <script>
    document.getElementById('formId')action="你的action";
    document.getElementById('formId').submit();
    </script>
    改:
    <script>
    document.getElementById('formId').action="你的action";
    document.getElementById('formId').submit();
    </script>