日期:2014-05-18  浏览次数:20616 次

struts logic:iterate 集合
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该怎么写???

------解决方案--------------------
用内嵌的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>

------解决方案--------------------
探讨
用内嵌的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>

------解决方案--------------------
探讨
用内嵌的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>

------解决方案--------------------
探讨
用内嵌的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>

------解决方案--------------------
<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>

------解决方案--------------------
request.setattribute("","");
------解决方案--------------------
咋不用el表达式 省去了不必要的麻烦
------解决方案--------------------
你看有关order的名称写错没有,2楼的解决是可行的,我也做过类似的。
------解决方案--------------------
探讨
Cannot find bean: "order" in any scope