List list=dao.findAll();这个集合里面放的是customer对象:
customer对象属性:客户id,客户姓名, 客户年龄, 客户性别,orders(订单集合)把这里的信息显示到页面
request.setattribute("customer",list);
<logic:iterate id="c" name="customer">
<bean:write name="c" property="customerId"/>
.......
</logic:iterate>这里面的orsers该怎么写???

解决方案 »

  1.   

    用内嵌的iterate,代码大概就这样的,好久没用了。
    <logic:iterate id="c" name="customer">
             <bean:write name="c" property="customerId"/> 
             <logic:iterate id="orderIds"  name="order">
                    <bean:write name="orderIds" property="orderId">
              </logic:iterate>
    <logic:iterate>
      

  2.   


    在2楼的代码外还可以嵌套上<logic:present name="LIST">
    加上2楼的代码
    </logic:present>
    <logic:notPresent name="LIST">
    <tr class="TableItemStyle">
    <td colspan="4" align=center>
    无相关记录
    </td>
    </tr>
    </logic:notPresent>
      

  3.   

    Cannot find bean: "order" in any scope
    不行啊!!
      

  4.   


    错误应该是在:<logic:iterate id="orderIds"  name="order"> 
    你在做用户添加的时候是把相关的订单一起添加进去了!应该在action层,把所有的order也一起放到request.setattribute("order",list);里面去!
     
      

  5.   

    <logic:present name="customer">
       <logic:iterate id="searchList" name="customer">

    <tr >
    <td align="center"><bean:write name = "searchList" property = "客户id"/></td>
    <td align="center"><bean:write name = "searchList" property = "客户姓名"/></td>
    <td align="center"><bean:write name = "searchList" property = "客户年龄"/></td>
                     ……
    </tr>

       </logic:iterate>
    </logic:present>
      

  6.   

    你看有关order的名称写错没有,2楼的解决是可行的,我也做过类似的。
      

  7.   


    <logic:iterate id="c" name="customer"> 
            <bean:write name="c" property="customerId"/>        <logic:iterate id="index" name="c" property="订单字段名"
                    <bean:write name="index" property="要显示的字段">
            </logic:iterate><logic:iterate>
      

  8.   

    看来是我代码写的有问题(不是order名称问题),我重写了下 测试通过了 
    谢谢大家帮忙了