<% sql
List<List> list = (List<List>)request.getAttribute("list");jsp
for(List li : list) {spa
response.getWriter().write("主表:" + li.get(0).toString() +"<br>");blog
List<Blog> list2 = (List<Blog>)li.get(1);get
for(int i=0; i< list2.size();i++){it
response.getWriter().write("一個字段:" + list2.get(i).getInt("order_id")+"<br>");date
response.getWriter().write("zi表:"+i+" ===" + list2.toString()+"<br>");List
}select
response.getWriter().write("<br>");request
}
%>
<%=list.get(2).size() %>
Map<Object, List<Blog>> map = new TreeMap<Object, List<Blog>>();
List<List> list = new ArrayList<List>();
String sql="select order_id, buyer_mem_name ,sale_date,total_money,buyer_mem_id from blog where buyer_mem_id=1011";
List<Blog> salsList=Blog.dao.find(sql);
System.out.println("list大小是:"+salsList.size()+"==");
for (Blog blog : salsList){
List list2 = new ArrayList();
int orderId=blog.getInt("order_id");
String selet="select b.PRODUCT_NAME,b.PRO_TYPE,b.SEND_QUANTITY from blog a inner join product_sale_details b on a.order_id =b.order_id where a.BUYER_MEM_ID=1011 and a.order_id="+orderId+"";
List<Blog> alllist=Blog.dao.find(selet);
//map.put(blog, alllist);
list2.add(blog);
list2.add(alllist);
list.add(list2);
System.out.println("----------0000" + alllist.size());
}
System.out.println(list.get(0).get(0).toString()+"---00-------");
System.out.println(list.get(1).get(1).toString()+"--11--------");
System.out.println(list.get(2).get(1).toString()+"---22-------");
setAttr("list", list);
render("blog.jsp");