网点名称 留仓件数 网点名称 留仓件数 网点名称 留仓件数
北京中关村 7 道里安鸿分部 2 东山D 7
东莞樟木头 1 广州海珠 155 哈尔滨学府分部 8
东莞中心 103 广州中心 49 杭州中转部 1123
广德 10 哈尔滨 6 黄浦 65
我查询出来一个list集合,在页面需要这样显示。我用的struts标签,不知道如何才能得到这样的效果!这是在一个表格中 每行显示6列!
最好附带一点源代码!谢谢
北京中关村 7 道里安鸿分部 2 东山D 7
东莞樟木头 1 广州海珠 155 哈尔滨学府分部 8
东莞中心 103 广州中心 49 杭州中转部 1123
广德 10 哈尔滨 6 黄浦 65
我查询出来一个list集合,在页面需要这样显示。我用的struts标签,不知道如何才能得到这样的效果!这是在一个表格中 每行显示6列!
最好附带一点源代码!谢谢
<logic:iterate id="getMessage" name="messageList" indexId="index">
<logic:present name="getMessage">
<tr height="25">
<td colspan="2">
<bean:write name="getMessage" property="content"/>
</td>
</logic:present>
</logic:iterate>
</table>
messageList在action中指定
//获取留言列表
messageList = messageService.getAllMessage();
request.setAttribute("messageList",messageList);content就是相应的属性
</logic:iterate>
int flag = 0;
ArrayList bigAl = new ArrayList();
ArrayList smallAl = new ArrayList();
//stuScores是大的那個結果集,就是你搜索出來的。
for(int i=0;i<stuScores.size();i++)
{
flag++;
if(flag<4)
{
smallAl.add(stuScores.get(i));
}
if(flag==3)
{
flag=0;
bigAl.add(smallAl);//滿三個了,就塞到bigAl里,在前臺取出bigAl就可以顯示三個一行了。
smallAl = new ArrayList();
}
}
<tr>
<td align="right">
${www.count}
<td>
<td align="right">
<s:property value="txt1"/>
<td>
<td>
<s:property value="txt2"/>
</td>
<td>
<s:property value="txt3"/>
</td>
</tr>
</s:iterator>Action中代码:public List<IteratorBean> getList() { List<IteratorBean> lstBook = new ArrayList<IteratorBean>(); IteratorBean bean = null; bean = new IteratorBean(); bean.setTxt1("Struts2权威");
bean.setTxt2("精通Struts1");
bean.setTxt3("Spring in Action"); lstBook.add(bean); bean = new IteratorBean(); bean.setTxt1("卡卡");
bean.setTxt2("内斯塔");
bean.setTxt3("卡西利亚斯"); lstBook.add(bean); bean = new IteratorBean(); bean.setTxt1("百事");
bean.setTxt2("可口");
bean.setTxt3("非常"); lstBook.add(bean); bean = new IteratorBean(); bean.setTxt1("苹果");
bean.setTxt2("桃子");
bean.setTxt3("西瓜"); lstBook.add(bean); bean = new IteratorBean(); bean.setTxt1("鳗鱼");
bean.setTxt2("金枪鱼");
bean.setTxt3("鲅鱼"); lstBook.add(bean); return lstBook;
}
cellspacing="1" class="TABLETWO" id="table1">
<tr class=LISTTitle>
<td>序号</td>
<td>起点桩号</td>
<td>结束桩号</td>
<td>路线等级</td>
<td>路面类型</td>
<td>检查次数</td>
<td>操作</td>
</tr>
<%-- roadSections 为传过来的 List,List 中的每一条记录为一个对象,包含roadStart、roadEnd等属性 --%>
<logic:iterate id="roadSection" name="roadSections" indexId="id">
<tr class=LISTBODY>
<td>${id+1}</td>
<td>
<bean:write name="roadSection" property="roadStart" />
</td>
<td>
<bean:write name="roadSection" property="roadEnd" />
</td>
<td>
<bean:write name="roadSection" property="roadLevel" />
</td>
<td>
<bean:write name="roadSection" property="roadSurface" />
</td>
<td>
<bean:write name="roadSection" property="frequency" />
</td>
<td>
<a
href="checkHandle.do?do=findMain&selWay==&roadStart1=<bean:write name="roadSection" property="roadStart"/>&roadStart2=<bean:write name="roadSection" property="roadEnd"/>&dd=aa">查看</a>
<a
href="checkHandle.do?do=addEdit&roadSurface=<bean:write name="roadSection" property="roadSurface" />a&roadStart=<bean:write name="roadSection" property="roadStart"/>&roadEnd=<bean:write name="roadSection" property="roadEnd"/>&roadLevel=<bean:write name="roadSection" property="roadLevel" />a">添加</a>
<a
href="excelInsert.do?do=doExcelInput&roadStart=<bean:write name="roadSection" property="roadStart" />&roadEnd=<bean:write name="roadSection" property="roadEnd" />&roadSurface=<bean:write name="roadSection" property="roadSurface" />a">excel导入</a>
</td>
</tr>
</logic:iterate>
</table>================================
Action 代码:public ActionForward findRoadInfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception { String condition = request.getParameter("condition") == null ? null
: new String(request.getParameter("condition").getBytes(
"iso8859-1"), "UTF-8");
Road road = rmanager.getRoadByCode(condition);
//取出该路线所有的分段信息
List roadZones = sysManager.getRoadZonesByRoadCode(condition);
List upRoadvos = loadUpRoadVo(roadZones,road);
request.setAttribute("upRoadvos", upRoadvos);
List downRoadvos = loadDownRoadVo(roadZones,road);
request.setAttribute("downRoadvos", downRoadvos);
List oneRoadvos = loadOneRoadVo(roadZones,road);
request.setAttribute("oneRoadvos",oneRoadvos);
List roadList=new LinkedList();
String roadName= road.getRoadName();
String roadCode=road.getRoadCode();
System.out.println(roadCode);
roadList.add(roadName);
roadList.add(roadCode);
HttpSession session = request.getSession(true);
session.setAttribute("roadList", roadList);
request.setAttribute("roadList", roadList);
List roadSections = loadRoadVo(road);
session.setAttribute("roadSections", roadSections);
session.setAttribute("road", road);
return mapping.findForward("roadInfo");
}