如何构建这个HTML表?

时间:2014-09-24 16:37:43

标签: html jsp

+-----------+-----------+-------------------------------------------+
| header    | header2   | header3                                   |
+           +           +-------------------------------------------+
|           |           | subheader           | subheader           |
+-----------+-----------+---------------------+---------------------+
|  row data1| row data2 | row row1 data 3.1.1 | row row1 data 3.1.2 |
+           +           +---------------------+---------------------+
|           |           | row row2 data 3.2.1 | row row2 data 3.2.2 |
+           +           +---------------------+---------------------+
|           |           | row row3 data 3.3.1 | row row3 data 3.3.2 |
+-----------+-----------+---------------------+---------------------+

如何使用spring在JSP中创建这样的表。该行是通过循环生成的。该行必须包含两个子标题的多个数据行。对于每一行,子标题中都有多个表数据行。示例:数据3.1.1对应于循环中的数据3.1.2。

1 个答案:

答案 0 :(得分:0)

像这样:

<table>
    <tr>
        <td rowspan="2">header 1</td>
        <td rowspan="2">header 2</td>
        <td colspan="2">header 3</td>
    </tr>
    <tr>
        <td>subheader</td>
        <td>subheader</td>
    </tr>
    <tr>
        <td rowspan="3">rowdata 1</td>
        <td rowspan="3">rowdata 2</td>
        <td>rowdata 3.1.1</td>
        <td>rowdata 3.1.2</td>
    </tr>
    <tr>
        <td>rowdata 3.2.1</td>
        <td>rowdata 3.2.2</td>
    </tr>
    <tr>
        <td>rowdata 3.3.1</td>
        <td>rowdata 3.3.2</td>
    </tr>
</table>