这里只有一个表,表字段有group2id,group3id,userid,group2id为推荐人二级部门ID,group3id为推荐人三级部门ID,userid为推荐人ID, 
有三个LIST,分别为ArrayList group2List=Manager.getInstance.getGroup2IdList(); 
ArrayList group3List =Manager.getInstance.getGroup2IdList(group2id); 
ArrayList userList =Manager.getInstance.getGroup2IdList(group3id); 
要展现成如图片那样,代码应该怎么写,或者什么思路,谢谢了,解决就给分!

解决方案 »

  1.   

    什么MVC框架?
    这关系到输出的代码。
      

  2.   

    模块要求很急,对html不是很在行,希望有人帮我写下这块代码,多谢了。。
      

  3.   

    不是什么MVC结构,就是普通的jsp页面,谢谢楼上的
      

  4.   

    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <table width="619" height="418" border="1">
      <tr>
        <td width="198">二级</td>
        <td width="118">三级</td>
        <td width="102">推荐人</td>
        <td width="82">后付款</td>
        <td width="85">半年/全年卡</td>
      </tr>
      <tr>
        <td rowspan="6">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td rowspan="2">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>其他的自己填吧!
      

  5.   

    用 Dreamweaver 建个JSP  像WORD那样设置单元格  (单元格中还可以加东东)不知道你要的是不是这个东西
      

  6.   

    #region 合并单元格
    private void SpanRow(DataGrid dg,int col1,int col2,int col3,int row,int rownum)
    {
    int i,j;

    int subrow = row;
    for( i=row;i<rownum;i++ )
    {
    int intSpan=1;
    string strA1=dg.Items[i].Cells[col1].Text.Trim();
    string strA2=dg.Items[i].Cells[col2].Text.Trim();
    string strA3=dg.Items[i].Cells[col3].Text.Trim();
    for( j=i+1;j<rownum;j++)
    {
    string strB1=dg.Items[j].Cells[col1].Text.Trim();
    string strB2=dg.Items[j].Cells[col2].Text.Trim();
    string strB3=dg.Items[j].Cells[col3].Text.Trim();
    if(strA1==strB1 && strA2==strB2 && strA3==strB3)
    {
    intSpan++; dg.Items[i].Cells[col1-1].RowSpan = intSpan;
    dg.Items[i].Cells[col1-1].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col1-1].Visible = false; 
    dg.Items[i].Cells[col1].RowSpan = intSpan;
    dg.Items[i].Cells[col1].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col1].Visible = false; 
    dg.Items[i].Cells[col2].RowSpan = intSpan;
    dg.Items[i].Cells[col2].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col2].Visible = false; 
    dg.Items[i].Cells[col3].RowSpan = intSpan;
    dg.Items[i].Cells[col3].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col3].Visible = false; 
    }
    else
    {
    break;
    }
    } if( j>=rownum )
    {

    } i=j-1;
    subrow=j;
    }
    }

    #endregion
    this.grdReqNum.DataSource = ds.Tables[SL_SetFactoryData.SL_SETFACTORY_TABLE];
    this.grdReqNum.DataBind();
    //----------------------------------------------
    SpanRow(this.grdReqNum,2,3,4,0,this.grdReqNum.Items.Count);
    //----------------------------------------------
      

  7.   

    #region 合并单元格
    private void SpanRow(DataGrid dg,int col1,int col2,int col3,int row,int rownum)
    {
    int i,j;

    int subrow = row;
    for( i=row;i<rownum;i++ )
    {
    int intSpan=1;
    string strA1=dg.Items[i].Cells[col1].Text.Trim();
    string strA2=dg.Items[i].Cells[col2].Text.Trim();
    string strA3=dg.Items[i].Cells[col3].Text.Trim();
    for( j=i+1;j<rownum;j++)
    {
    string strB1=dg.Items[j].Cells[col1].Text.Trim();
    string strB2=dg.Items[j].Cells[col2].Text.Trim();
    string strB3=dg.Items[j].Cells[col3].Text.Trim();
    if(strA1==strB1 && strA2==strB2 && strA3==strB3)
    {
    intSpan++; dg.Items[i].Cells[col1-1].RowSpan = intSpan;
    dg.Items[i].Cells[col1-1].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col1-1].Visible = false; 
    dg.Items[i].Cells[col1].RowSpan = intSpan;
    dg.Items[i].Cells[col1].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col1].Visible = false; 
    dg.Items[i].Cells[col2].RowSpan = intSpan;
    dg.Items[i].Cells[col2].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col2].Visible = false; 
    dg.Items[i].Cells[col3].RowSpan = intSpan;
    dg.Items[i].Cells[col3].VerticalAlign=VerticalAlign.Middle;   
    dg.Items[j].Cells[col3].Visible = false; 
    }
    else
    {
    break;
    }
    } if( j>=rownum )
    {

    } i=j-1;
    subrow=j;
    }
    }

    #endregion
    this.grdReqNum.DataSource = ds.Tables[SL_SetFactoryData.SL_SETFACTORY_TABLE];
    this.grdReqNum.DataBind();
    //----------------------------------------------
    SpanRow(this.grdReqNum,2,3,4,0,this.grdReqNum.Items.Count);
    //----------------------------------------------
      

  8.   

    我的数据都是写在一个表里,这个二级部门ID,三级部门ID,是和组织部门GROUP表相关联,可能这样是不好,但当时没有想到这样统计,我觉得应该也能够统计出来的。。
      

  9.   

    既然你的数据都是写在一个表中,怎么会有三个List呢?
    其它两个List是读取部门信息表的吧?首先:如果读取数据库代码是你写的话!
    用join语句将用户表和部门表的数据一次性返回到一个List中.
    这样你前面显示就很好处理.
      

  10.   

    <table>
         <tr>
         <td>2id</td>
         <td>3id</td>
         <td>uid</td>
         </tr>
         <%
         ArrayList group2List=Manager.getInstance.getGroup2IdList(); 
         for(int i = 0;i<group2List.size();i++)
         {
         String name_2 = (String)group2List.get(i);
         %>
         <tr>
         <td>name_2</td>
         <%
         ArrayList group3List =Manager.getInstance.getGroup2IdList(group2id);
         for(int j = 0;j<group3List.size();j++)
         {
         String name_3 = (String)group3List.get(j);
         %>
         <td>name_3</td>
         <%
         ArrayList userList =Manager.getInstance.getGroup2IdList(group3id); 
         for(int k = 0;k < userList.size();k++)
         {
         String uname = (String)userList.get(k);
         %>
         <td>uname</td>
         <%
         }
          %>
         <%
         }
          %>
         </tr>
         <%
         }
          %>
        </table>
      

  11.   

    我建议你构造一个对象,such as
    public class A(){//二级推荐人部门
      //some properties
      private List list;//B的集合
      //get method for list
      //set method for list
      // other properties get method
      // other properties set method
    }public class B(){//三级推荐人部门
      //some properties
      private List list;//C的集合
      //get method for list
      //set method for list
      // other properties get method
      // other properties set method
    }
    public class C(){//人员
      //some properties
      private List list;
      //get method for list
      //set method for list
      // other properties get method
      // other properties set method
    }
    在页面上显示时,直接迭叠出来就行了。不知道楼主能否明白?