遍历list 及取list下标

后台传入数据如下:
request.setAttribute("list",listGoodsSaleRank);
jsp页面遍历如下:
<table width="50%" border="0" cellspacing="1" cellpadding="2" align="center" class="table-bg">
        <tr class="td-list-title">
            <td>排名td>
            <td>类型(商品名称)td>
            <td>售出量td>
            <td>下单量td>
            <td>总金额td>
            <td>下单人数td>
        tr>
        <s:iterator value="#request.list" status="status" >
            <tr class="td-list-1">
                <s:iterator value="#request.list.get(#status.index)">
                    <td valign="middle" align="center"><s:property value='#status.index+1'/>td>
                s:iterator>
                <td align="left">${goodsName}td>
                <td align="center">${saleNum}td>
                <td align="center">${orderNum}td>
                <td align="center">${amount}td>
                <td align="center">${buyerNum}td>
            tr>
        s:iterator>
    table>

效果如下:
遍历list 及取list下标_第1张图片

你可能感兴趣的:(前端技术)