我遍历了一个集合,我要吧集合里面ID这个属性放到CheckBox里面 
提交把选中的ID传到Action 
页面怎么写,ACTION怎么写  要考虑多选后传多个ID的问题。
后面TYPE==1可以无视 那是加的一个判断。
主要是传参与接受 怎么写  各位大神 教教小弟阿。
 <logic:iterate id="tkx" name="pecForm" property="EmptyBoxList" >
                <tr>
                 <td class=<%=n%2==0?"tabletd1":"tabletd2"%> >
                   <input type="checkbox" name="id" value=${id} ${type==1 ? "disabled='disabled'" :"" }/>
                  </td>
 </logic:iterate>

解决方案 »

  1.   


    var inputs = document.getElementsByTagName("input");
    var val = "";
    for(var i = 0; i < inputs.length; i++) {
         if(inputs[i].type == "checkbox" && inputs[i].checked) {
               val = val== "" ? inputs[i].value : "," + inputs[i].value
         }
    }document.forms[0].action = "xxx.action?val=" + val;
    document.forms[0].submit();
      

  2.   

    页面就那样循环,  name值一样,  让后action有对应name的的字段,提供getter和setter方法,就能拿到。
      

  3.   

       我要从页面更新, where  条件是多选ID的值, 更新的内容是个文本框的值 
       一次可选多条,点更新 就把修改的更新
        大哥  怎么写阿  没头绪。
        给我点头绪  40分给你  呵呵。
      

  4.   


    我要从页面更新, where 条件是多选ID的值, 更新的内容是个文本框的值  
      一次可选多条,点更新 就把修改的更新
      大哥 怎么写阿 没头绪。
      给我点头绪 40分给你 呵呵。
      

  5.   

    <input type="checkbox" name="box" value="1">
    <input type="checkbox" name="box" value="2">
    <input type="checkbox" name="box" value="3">
    <input type="checkbox" name="box" value="4">
    后台request.getParameterValues("box");得不到???
      

  6.   

       是个string[] ???
      

  7.   

    request.getparamterValues() 得到是一个数组。用个数组接,然后再用for循环得数据就行了  我也新手
      

  8.   

    这个不难,我用这个方法就可以了
    页面:<input type="checkbox" name="ids" value="${id}"/>
    action里:定义private Long[] ids; 使用setter getter方法获取就可以得到ids的值了。
    行的话,结贴哈!
      

  9.   


    后台request.getPar...得到的是String[]
      

  10.   

     <%String[] name =  request.getParameterValues("box");
      
       String value1="";
       for(int i=0;i<name.length;i++){
       value1= name[i]+"☆";
       out.print(value1);
       }
       %>
      

  11.   


    用我查询出来的那个对象? 自动映射的嘛?  需要继承ActionForm?
      

  12.   

    恩 是的 ${id}是你循环出来的id的值 忘了我用的是struts2做的action需要继承ActionSupport
      

  13.   

     <tr>
                <td class="BTABBODY2" valign="top" width="100%">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                    <tr>
                    <td class="tabletitle" nowrap ></td>
                       <td class="tabletitle" nowrap width="10%">TRIP号</td>
                      <td class="tabletitle" nowrap width="10%">供应商号</td>
                      <td class="tabletitle" nowrap width="10%">供应商名称</td>
                      <td class="tabletitle" nowrap width="10%">送货仓库代码</td>
                      <td class="tabletitle" nowrap width="10%">送货仓库名称</td>
                      <td class="tabletitle" nowrap width="10%">料箱名称</td>
                      <td class="tabletitle" nowrap width="10%">空箱数量</td>
                      <td class="tabletitle" nowrap width="10%">工厂代码</td>
                      <td class="tabletitle" nowrap width="10%">实取数量</td>
                      <td class="tabletitle" nowrap width="10%">类型</td>
                      
                    
                    </tr>   
                     <%int n=0;int i=0;%>
                    <logic:iterate id="tkx" name="pecForm" property="EmptyBoxList" >
                    <tr>
                     <td class=<%=n%2==0?"tabletd1":"tabletd2"%> >
                       <input type="checkbox" name="id" value=${id} ${type==1 ? "disabled='disabled'" :"" }/>
                      </td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="tripid" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="supplier_code" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="suppliername" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="location_code" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="locationdesc" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="name" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="packageQty" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><bean:write name="tkx" property="factory_code" /></td>
                      <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap><input type="text" value="<bean:write name="tkx" property="re_qty" />" size="8" ${type==1 ? "readonly='readonly'" :"" } ></td>
                      <logic:equal   name= "tkx"   value= "0 "   property="type"> 
    <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap>未提取</td>
                      </logic:equal>
                       <logic:equal   name= "tkx"   value= "1"   property="type"> 
    <td class=<%=n%2==0?"tabletd1":"tabletd2"%> nowrap>已提取</td>
                      </logic:equal>
                   </tr>
                   <%n++;%>
                   </logic:iterate>怎么把多选绑定ID  提交的时候 把文本框的值 和多选框的值传过去。 循环查询。
      

  14.   

    LZ你不是就想把前台CheckBox的值传到action吗?传一个和传多个是一样的
      

  15.   

     试了一下  输出ID 显示 /// 文本框是NULL 知道怎么取了 怎么在页面绑定?
      

  16.   

    批量修改,是sql或者是hql语句的问题,你只要把checkbox的值用数组在action中获得,在批量修改的时候写hql语句就行了,如:update BaseStaff baseStaff set baseStaff.delstatus='已删除' where baseStaff.id in(:ids)其中ids就是action里数组ids的值
      

  17.   

    知道如何取文本框的值的话,按照上面的语句把某个想要修改的值改成文本框中的值,如:set name = "文本框中获得的值"就行了