Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 在JSP中以2列显示数据_Jquery_Jsp_Jstl - Fatal编程技术网

Jquery 在JSP中以2列显示数据

Jquery 在JSP中以2列显示数据,jquery,jsp,jstl,Jquery,Jsp,Jstl,例如,我有以下数据: 非洲 印度 澳大利亚 美国 俄罗斯 等等 这是我从数据库中收到的名为“国家”的数据 现在我想显示这些数据,以便在加载jsp时显示如下: 我用jsp编写的代码如下: ${country.index}${country.title} 如果在国家/地区中有N个元素,则半索引为N/2 <table> <tr> <td> <c:forEach items="${country}" var=

例如,我有以下数据:

  • 非洲
  • 印度
  • 澳大利亚
  • 美国
  • 俄罗斯
  • 等等
  • 这是我从数据库中收到的名为“国家”的数据

    现在我想显示这些数据,以便在加载jsp时显示如下:

    我用jsp编写的代码如下:

    
    ${country.index}${country.title}

    如果在
    国家/地区中有N个元素,则
    半索引
    N/2

    <table>
        <tr>
            <td>
                <c:forEach items="${country}" var="countrySetA" begin="0" end="${halfIndex}">
                    ${countrySetA.index} ${countrySetA.title}<br/>
                </c:forEach>
            </td>
            <td>
                <c:forEach items="${country}" var="countrySetB" begin="${halfIndex}">
                    ${countrySetB.index} ${countrySetB.title}<br/>
                </c:forEach>
            </td>
        </tr>
    </table>
    
    
    ${countrySetA.index}${countrySetA.title}
    ${countrySetB.index}${countrySetB.title}

    添加另一列并循环行(如果您也想这样做,也可以循环两列)

    
    ${country.index}
    ${country.title}
    
    图像未显示
    <table>
    <c:forEach items="${country}" var="country">
    <tr>
    <td>
    ${country.index}
    </td>
    <td>
    ${country.title}
    </td>
    </tr>
    </c:forEach>
    </table>