1.在Action中从数据库中取出所有的FFuncno(选中和没有选中的)集合(ArrayList)放到Bean A里(scope:request或session).
2.在Action中从数据库中取出选中的FFuncno,setter到显示页面对应的ActionForm的String[]属性中,把该ActionForm放到Bean B里(scope:request或session).
3.显示页面类似这样:
循环输出Bean A,jsp容器会利用标签把页面checkbox值存在于Bean B String[]属性中的复选框选中.(我每一行输入四个checkbox)
<logic:present name="er_list" scope="session">
<tr>
<logic:iterate name="er_list" id="list" scope="session">
<td height="25">
<html:multibox property="erid"><bean:write name="list" property="erid"/></html:multibox>
<bean:write name="list" property="cname"/>
</td>
<bean:define id="divideRow" value="<%=String.valueOf(++index%4)%>"></bean:define>
<logic:equal name="divideRow" value="0"></tr><tr></logic:equal>
</logic:iterate>
</logic:present>

解决方案 »

  1.   

    还是有些模糊,这位大哥能不能把action的内容贴出来我详细的理解一下,因为关系到很多实现的细节,比如说一个表中同一字段要取两次
      

  2.   

    1.假设显示页面对应的ActionForm名为EnterpriseForm,它应有以下代码:
    private String[] fFuncno=null;
    public void setFFuncno(String[] s) {
    fFuncno=s;
    }
    public String[] getFFuncno() {
    return fFuncno;
    }
    用于循环输出所有的FFuncno的Bean类A,应有以下代码:
    private String fFuncno=null;
    private String fFname=null;
    public void setFFuncno(String s) {
    fFuncno=s;
    }
    public String getFFuncno() {
    return fFuncno;
    }
    public void setFFname(String name) {
    fFname=name;
    }
    public String getFFname() {
    return fFname;
    }
    2.Action:
    ..................
    EnterpriseForm er = new EnterpriseForm();
    A beanA = new A();
    ArrayList list= new ArrayList();
    String sql = "select FFuncno,FFname from yourtable";
    ResultSet rs = stmt.executeQuery(sql);
    while (rs.next()) {
    beanA.setFFuncno(rs.getString("FFuncno"));
    beanA.setFFuncno(rs.getString("FFname"));
    list.add(beanA);
    }
    ......................
    sql = "select count(*) from yourtable where 条件";
    rs = stmt.executeQuery(sql);
    rs.next();
    String[] strArray=new String[rs.getInt(1)];
    sql = "select FFuncno,FFname from yourtable where 条件";(取出选中的)
    rs = stmt.executeQuery(sql);
    int i=0;
    while (rs.next()) {
    strArray[i]=rs.getString("FFuncno");
    i++;
    }
    er.setFFuncno(strArray);
    ......................
    request.setAttribute("er_list",list);
    request.setAttribute("enterpriseForm",er);return mapping.findForward("success");
    3.显示页面,注意该页面所对应的<form-bena>的名字为enterpriseForm.
    <logic:present name="er_list" scope="request">
    <tr>
    <logic:iterate name="er_list" id="list" scope="request">
    <td height="25">
    <html:multibox property="fFuncno"><bean:write name="list" property="fFuncno"/></html:multibox>
    <bean:write name="list" property="fFname"/>
    </td>
    <bean:define id="divideRow" value="<%=String.valueOf(++index%4)%>"></bean:define>
    <logic:equal name="divideRow" value="0"></tr><tr></logic:equal>
    </logic:iterate>
    </logic:present>