struts标签的嵌套循环 生成动态数据表头表列

 

前段jsp代码

<!-- 列表部分开始 -->
  <table id="LodgeInfo" class="dataList" width="100%" cellspacing="0" border="0">
  <!-- 表头 -->
<thead>
<tr>
<th width="3%"><input type="checkbox" onclick="selectAll()"></th>
<th style="cursor: hand" title="点击排序"
onclick="orderBy('DUTY_DATE')">日期</th>
<logic:present name="taixiList">
<logic:iterate id="taixi" name="taixiList">
<th style="cursor: hand" title="点击排序"
onclick="orderBy('<bean:write name="taixi"/>')"><bean:write
name="taixi" property="SITE_NAME" /></th>
</logic:iterate>
</logic:present>
</tr>
</thead>


<!--表列 -->
<tbody>
<logic:present name="volist">
<bean:define id="list" name="volist" />
<logic:iterate id="li" name="list">
<bean:define id="ub" name="li" />
<!-- 字段内容部分开始 -->
<tr class="bg"
onClick="row_selectesd(this,'LodgeInfo','rowindex','rowcolor','keyvalue','orgId');">
<td>
      <input type="checkbox" name="ids" value="<bean:write name="ub" property="DUTY_DATE"/>">
  <input type="hidden" id="rowkeyvalue" name="rowkeyvalue" value='<bean:write name="ub" property="DUTY_DATE"/>'>
  <input type="hidden" id="ordids" name="ordids" value='<bean:write name="ub" property="ORG_ID"/>'>
</td>
<td><bean:write name="ub" property="DUTY_DATE"
format="yyyy-MM-dd" />&nbsp;
</td>
<logic:present name="taixiList">
<logic:iterate id="taixi" name="taixiList">
<bean:define id="test" name="taixi" property="SITE_NO" />
<%
String str = "A" + test;
%>

<td><a href="inspect/duty/InspectDuty1.do?method=updateTaixi&flag=${flag}
                    &commId=<bean:write name="ub" property="<%=str%>" />&dutyDate=<bean:write name="li" property="DUTY_DATE" />"> <bean:write name="ub" property="<%=str%>" />&nbsp;</td>
</logic:iterate>
</logic:present>
</tr>
</logic:iterate>
</logic:present>
</tbody>

<!-- 字段内容部分结束 -->
<!-- 分页栏开始 -->
<tfoot>
<%@include file="/public/pubpage1.jsp"%>
</tfoot>
<!-- 分页栏结束 -->
  </table>

  后台 java代码

         


  request.setAttribute("taixiList", taixiList);
/*数据格式 1taixiList-----------------[{SITE_NO=0144004212001, SITE_NAME=台席台席1(合规经理)}, {SITE_NO=0144004212002, SITE_NAME=台席2}, {SITE_NO=0144004212003, SITE_NAME=台席3}, {SITE_NO=0144004212004, SITE_NAME=台席4}, {SITE_NO=0144004212005, SITE_NAME=台席5}, {SITE_NO=0144004212006, SITE_NAME=台席6}]
*/

/**
2volist-----------------[{DUTY_DATE=2014-06-17, ORG_ID=441201008, A0144004212001=20060812431, A0144004212002=20060812431, A0144004212003=20060705171, A0144004212004=19940901981, A0144004212005=19910601251, A0144004212006=19910601251, ROWNUM_=1}, {DUTY_DATE=2014-06-27, ORG_ID=441201008, A0144004212001=19880901431, A0144004212002=null, A0144004212003=null, A0144004212004=null, A0144004212005=null, A0144004212006=null, ROWNUM_=2}]
*/
request.setAttribute("volist", volist);
page.saveToRequest(request);
request.setAttribute("method", "list");
return LIST_FORWARD;
}






你可能感兴趣的:(struts)